Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

967 lines
20 KiB

  1. /*++
  2. Copyright (c) 1990-1995 Microsoft Corporation
  3. Module Name:
  4. compstui.c
  5. Abstract:
  6. This module contains all major entry porint for the common printer
  7. driver UI
  8. Author:
  9. 28-Aug-1995 Mon 16:19:45 created -by- Daniel Chou (danielc)
  10. [Environment:]
  11. NT Windows - Common Printer Driver UI DLL.
  12. [Notes:]
  13. Revision History:
  14. --*/
  15. #include "precomp.h"
  16. #pragma hdrstop
  17. #define DBG_CPSUIFILENAME DbgComPtrUI
  18. #define DBG_DLLINIT 0x00000001
  19. DEFINE_DBGVAR(0);
  20. HINSTANCE hInstDLL = NULL;
  21. DWORD TlsIndex = 0xFFFFFFFF;
  22. DWORD
  23. APIENTRY
  24. CommonPropSheetUI_DLLInit(
  25. HMODULE hModule,
  26. ULONG Reason,
  27. LPVOID Reserved
  28. )
  29. /*++
  30. Routine Description:
  31. This function is DLL main entry point, at here we will save the module
  32. handle, in the future we will need to do other initialization stuff.
  33. Arguments:
  34. hModule - Handle to this moudle when get loaded.
  35. Reason - may be DLL_PROCESS_ATTACH
  36. Reserved - reserved
  37. Return Value:
  38. Always return 1L
  39. Author:
  40. 07-Sep-1995 Thu 12:43:45 created -by- Daniel Chou (danielc)
  41. Revision History:
  42. --*/
  43. {
  44. LPVOID pv;
  45. WORD cWait;
  46. WORD Idx;
  47. UNREFERENCED_PARAMETER(Reserved);
  48. CPSUIDBG(DBG_DLLINIT,
  49. ("\n!! CommonPropSheetUI_DLLInit: ProcesID=%ld, ThreadID=%ld !!",
  50. GetCurrentProcessId(), GetCurrentThreadId()));
  51. switch (Reason) {
  52. case DLL_PROCESS_ATTACH:
  53. CPSUIDBG(DBG_DLLINIT, ("DLL_PROCESS_ATTACH"));
  54. // initialize fusion
  55. if (!SHFusionInitializeFromModule(hModule)) {
  56. CPSUIERR(("SHFusionInitializeFromModule Failed, DLL Initialzation Failed"));
  57. return (0);
  58. }
  59. if ((TlsIndex = TlsAlloc()) == 0xFFFFFFFF) {
  60. CPSUIERR(("TlsAlloc() Failed, Initialzation Failed"));
  61. return(0);
  62. }
  63. if (!HANDLETABLE_Create()) {
  64. TlsFree(TlsIndex);
  65. TlsIndex = 0xFFFFFFFF;
  66. CPSUIERR(("HANDLETABLE_Create() Failed, Initialzation Failed"));
  67. return(0);
  68. }
  69. hInstDLL = (HINSTANCE)hModule;
  70. //
  71. // Fall through to do the per thread initialization
  72. //
  73. case DLL_THREAD_ATTACH:
  74. if (Reason == DLL_THREAD_ATTACH) {
  75. CPSUIDBG(DBG_DLLINIT, ("DLL_THREAD_ATTACH"));
  76. }
  77. TlsSetValue(TlsIndex, (LPVOID)MK_TLSVALUE(0, 0));
  78. break;
  79. case DLL_PROCESS_DETACH:
  80. CPSUIDBG(DBG_DLLINIT, ("DLL_PROCESS_DETACH"));
  81. //
  82. // Fall through to de-initialize
  83. //
  84. case DLL_THREAD_DETACH:
  85. if (Reason == DLL_THREAD_DETACH) {
  86. CPSUIDBG(DBG_DLLINIT, ("DLL_THREAD_DETACH"));
  87. }
  88. pv = TlsGetValue(TlsIndex);
  89. if (cWait = TLSVALUE_2_CWAIT(pv)) {
  90. CPSUIERR(("Thread=%ld: Some (%ld) mutex owned not siginaled, do it now",
  91. GetCurrentThreadId(), cWait));
  92. while (cWait--) {
  93. UNLOCK_CPSUI_HANDLETABLE();
  94. }
  95. }
  96. if (Reason == DLL_PROCESS_DETACH) {
  97. TlsFree(TlsIndex);
  98. HANDLETABLE_Destroy();
  99. }
  100. if (DLL_PROCESS_DETACH == Reason) {
  101. // shutdown fusion
  102. SHFusionUninitialize();
  103. }
  104. break;
  105. default:
  106. CPSUIDBG(DBG_DLLINIT, ("DLLINIT UNKNOWN"));
  107. return(0);
  108. }
  109. return(1);
  110. }
  111. ULONG_PTR
  112. APIENTRY
  113. GetCPSUIUserData(
  114. HWND hDlg
  115. )
  116. /*++
  117. Routine Description:
  118. Arguments:
  119. Return Value:
  120. Author:
  121. 11-Oct-1995 Wed 23:13:27 created -by- Daniel Chou (danielc)
  122. Revision History:
  123. --*/
  124. {
  125. PMYDLGPAGE pMyDP;
  126. if ((pMyDP = GET_PMYDLGPAGE(hDlg)) && (pMyDP->ID == MYDP_ID)) {
  127. return(pMyDP->CPSUIUserData);
  128. } else {
  129. CPSUIERR(("GetCPSUIUserData: Invalid hDlg=%08lx", hDlg));
  130. return(0);
  131. }
  132. }
  133. BOOL
  134. APIENTRY
  135. SetCPSUIUserData(
  136. HWND hDlg,
  137. ULONG_PTR CPSUIUserData
  138. )
  139. /*++
  140. Routine Description:
  141. Arguments:
  142. Return Value:
  143. Author:
  144. 11-Oct-1995 Wed 23:13:27 created -by- Daniel Chou (danielc)
  145. Revision History:
  146. --*/
  147. {
  148. PMYDLGPAGE pMyDP;
  149. if ((pMyDP = GET_PMYDLGPAGE(hDlg)) && (pMyDP->ID == MYDP_ID)) {
  150. CPSUIINT(("SetCPSUIUserData: DlgPageIdx=%ld, UserData=%p",
  151. pMyDP->PageIdx, CPSUIUserData));
  152. pMyDP->CPSUIUserData = CPSUIUserData;
  153. return(TRUE);
  154. } else {
  155. CPSUIERR(("SetCPSUIUserData: Invalid hDlg=%08lx", hDlg));
  156. return(FALSE);
  157. }
  158. }
  159. #if 0
  160. //
  161. //=======O L D S T U F F, WILL BE REMOVED=========================
  162. //
  163. #define MAX_COMPROPSHEETUI_PAGES 64
  164. #define CPSUIHDRF_USESTARTPAGE 0x0001
  165. #define CPSUIHDRF_NOAPPLYNOW 0x0002
  166. #define CPSUIHDRF_PROPTITLE 0x0004
  167. #define CPSUIHDRF_USEHICON 0x0008
  168. #define CPSUIHDRF_DEFTITLE 0x0010
  169. typedef struct _COMPROPSHEETUIHEADER {
  170. WORD cbSize;
  171. WORD Flags;
  172. LPTSTR pTitle;
  173. HWND hWndParent;
  174. HINSTANCE hInst;
  175. union {
  176. HICON hIcon;
  177. WORD IconID;
  178. } DUMMYUNIONNAME;
  179. WORD cPages;
  180. WORD iStartPage;
  181. HPROPSHEETPAGE hPages[MAX_COMPROPSHEETUI_PAGES];
  182. LPVOID pData;
  183. LPARAM lParam;
  184. } COMPROPSHEETUIHEADER, *PCOMPROPSHEETUIHEADER;
  185. //
  186. // COMPROPSHEETUIHEADER
  187. //
  188. // This structure describe the property sheets needed for the UI.
  189. //
  190. // cbSize - size of this structure
  191. //
  192. // Flags - CPSUIHDRF_xxxx flags
  193. //
  194. // CPSUIHDRF_USESTARTPAGE
  195. //
  196. // Use iStartPage for the first page to be come up in
  197. // property sheet.
  198. //
  199. //
  200. // CPSUIHDRF_NOAPPLYNOW
  201. //
  202. // Remove Apply Now button.
  203. //
  204. //
  205. // CPSUIHDRF_PROPTITLE
  206. //
  207. // Automatically include 'Properties' in the title bar
  208. //
  209. //
  210. // CPSUIHDRF_USEHICON
  211. //
  212. // If this bit is specified then hIcon union field is
  213. // a valid handle to the icon otherwise the IconID is
  214. // the either caller's resource ID or common UI standard
  215. // icon ID.
  216. //
  217. // CPSUIHDRF_DEFTITLE
  218. //
  219. // Automatically include 'Default' in the title bar, the
  220. // 'Default' always added right after pTitle and before
  221. // 'Properties' if CPSUIHDRF_PROPTITLE flag is set.
  222. //
  223. // pTitle - Pointer to the NULL terminated caption name for the
  224. // property sheets.
  225. //
  226. // * See LPTSTR typedef description above
  227. //
  228. // hWndParent - The handle of the window which will be parent of the common
  229. // UI property sheets, if NULL then current active window for
  230. // the calling thread is used.
  231. //
  232. // hInst - the caller's handle to its instance. Commom UI use this
  233. // handle to load caller's icon and other resources.
  234. //
  235. // hIcon
  236. // IconID - Specified the icon which put on the title bar, it either a
  237. // handle to the icon or a icon resource ID depends on the
  238. // CPSUIHDRF_USEHICON flag.
  239. //
  240. // cPages - Total valid Pages (start from hPages[0]) currently
  241. // initialized and set in the hPage[].
  242. //
  243. // iStartPage - Zero-based index of initial page that appears when the
  244. // propperty sheet dialog box is created
  245. //
  246. // pData - Pointer to requested data for the called CommonPropSheetUI()
  247. // function. for the Common Prnter UI function
  248. // CommonPropSheetUI(), this must a valid pointer pointed to
  249. // the COMPROPSHEETUI structure.
  250. //
  251. // lParam - a LONG parameter which requested for the called
  252. // CommonPropSheetUI() function, for the common printer UI
  253. // function this is the mode
  254. //
  255. typedef LONG (APIENTRY *_COMPROPSHEETUIFUNC)(
  256. PCOMPROPSHEETUIHEADER pComPropSheetUIHdr,
  257. LONG (APIENTRY *pfnNext)());
  258. #define COMPROPSHEETUIFUNC LONG APIENTRY
  259. //
  260. // COMPROPSHEETUIFUNC
  261. // CommonPropSheeteUI(
  262. // PCOMPROPSHEETUIHEADER pComPropSheetUIHdr,
  263. // _COMPROPSHEETUIFUNC pfnNext
  264. // )
  265. //
  266. // /*++
  267. //
  268. // Routine Description:
  269. //
  270. // This is the main entry point to the common printer property sheet
  271. // user interface.
  272. //
  273. //
  274. // Arguments:
  275. //
  276. // pComPropSheetUIHdr - Pointer to the COMPROPSHEETUIHEADER structure.
  277. //
  278. // * The pData in this structure must be a valid
  279. // pointer to the COMPROPSHEETUI structure
  280. //
  281. // pfnNext - a _COMPROPSHEETUIFUNC pointer. This is the pointer
  282. // to the next CommonPropSheetUI function, when this
  283. // function finished adding property sheets to the
  284. // COMPROPSHEETUIHEADER structure, it will call this
  285. // function pointer.
  286. //
  287. // if this function pointer is NULL then it will add its
  288. // own property sheet pages to the COMPROPSHEETUIHEADER
  289. // and then call PropertySheet() function to pop up the
  290. // proerty sheet UI
  291. //
  292. //
  293. // Return Value:
  294. //
  295. // <0: Error occurred (Return value is error code ERR_CPSUI_xxxx)
  296. // =0: User select 'Cancel' button (CPSUI_OK)
  297. // >0: User select 'Ok' button (CPSUI_CANCEL)
  298. //
  299. //
  300. // Author:
  301. //
  302. // 01-Sep-1995 Fri 12:29:10 created -by- Daniel Chou (danielc)
  303. //
  304. //
  305. //
  306. COMPROPSHEETUIFUNC
  307. CommonPropSheetUIA(
  308. PCOMPROPSHEETUIHEADER pComPropSheetUIHdr,
  309. _COMPROPSHEETUIFUNC pfnNext
  310. );
  311. COMPROPSHEETUIFUNC
  312. CommonPropSheetUIW(
  313. PCOMPROPSHEETUIHEADER pComPropSheetUIHdr,
  314. _COMPROPSHEETUIFUNC pfnNext
  315. );
  316. #ifdef UNICODE
  317. #define CommonPropSheetUI CommonPropSheetUIW
  318. #else
  319. #define CommonPropSheetUI CommonPropSheetUIA
  320. #endif
  321. //
  322. //==========================================================================
  323. //
  324. typedef struct _CPSUIHDREX {
  325. COMPROPSHEETUIHEADER Hdr;
  326. _COMPROPSHEETUIFUNC pfnNext;
  327. HANDLE hParent;
  328. PFNCOMPROPSHEET pfnCPS;
  329. DWORD Result;
  330. } CPSUIHDRX, *PCPSUIHDRX;
  331. LONG
  332. AddOldCPSUIPages(
  333. PCPSUIHDRX pCPSUIHdrX,
  334. BOOL Unicode
  335. )
  336. /*++
  337. Routine Description:
  338. Arguments:
  339. Return Value:
  340. Author:
  341. 03-Feb-1996 Sat 20:08:59 created -by- Daniel Chou (danielc)
  342. Revision History:
  343. --*/
  344. {
  345. HANDLE hAdd;
  346. HPROPSHEETPAGE hPage;
  347. LONG cPages = 0;
  348. UINT i;
  349. UINT iStartPage;
  350. DWORD dw;
  351. if (pCPSUIHdrX->Hdr.Flags & CPSUIHDRF_USESTARTPAGE) {
  352. iStartPage = (UINT)pCPSUIHdrX->Hdr.iStartPage;
  353. } else {
  354. iStartPage = 0xFFFF;
  355. }
  356. for (i = 0; i < (UINT)pCPSUIHdrX->Hdr.cPages; i++) {
  357. if (hPage = pCPSUIHdrX->Hdr.hPages[i]) {
  358. if (hAdd = (HANDLE)pCPSUIHdrX->pfnCPS(pCPSUIHdrX->hParent,
  359. CPSFUNC_ADD_HPROPSHEETPAGE,
  360. (LPARAM)hPage,
  361. (LPARAM)NULL)) {
  362. CPSUIDBG(DBG_ADDOLDCPSUI,
  363. ("AddOldCPSUIPage: Add %u hAdd=%08lx", i, hAdd));
  364. if (iStartPage == i) {
  365. pCPSUIHdrX->pfnCPS(pCPSUIHdrX->hParent,
  366. CPSFUNC_SET_HSTARTPAGE,
  367. (LPARAM)hAdd,
  368. (LPARAM)0);
  369. }
  370. cPages++;
  371. }
  372. } else {
  373. CPSUIERR(("AddOldCPSUIPage: Add hPage FAILED"));
  374. }
  375. pCPSUIHdrX->Hdr.hPages[i] = NULL;
  376. }
  377. if (pCPSUIHdrX->Hdr.pData) {
  378. if (hAdd = (HANDLE)pCPSUIHdrX->pfnCPS(pCPSUIHdrX->hParent,
  379. (Unicode) ?
  380. CPSFUNC_ADD_PCOMPROPSHEETUIW :
  381. CPSFUNC_ADD_PCOMPROPSHEETUIA,
  382. (LPARAM)pCPSUIHdrX->Hdr.pData,
  383. (LPARAM)&dw)) {
  384. CPSUIDBG(DBG_ADDOLDCPSUI,
  385. ("AddOldCPSUIPage: Add COMPROPSHEETUI Pages=%ld", dw));
  386. if ((iStartPage >= i) && (iStartPage < (UINT)(i + dw))) {
  387. pCPSUIHdrX->pfnCPS(pCPSUIHdrX->hParent,
  388. CPSFUNC_SET_HSTARTPAGE,
  389. (LPARAM)hAdd,
  390. (LPARAM)0);
  391. }
  392. while (dw--) {
  393. cPages++;
  394. pCPSUIHdrX->Hdr.hPages[i++] = NULL;
  395. }
  396. pCPSUIHdrX->Hdr.pData = NULL;
  397. } else {
  398. CPSUIERR(("AddOldCPSUIPage: Add COMPROPSHEETUI FAILED"));
  399. }
  400. }
  401. if (pCPSUIHdrX->pfnNext) {
  402. CPSUIDBG(DBG_ADDOLDCPSUI,
  403. ("AddOldCPSUIPage: Call pfnNext=%08lx", pCPSUIHdrX->pfnNext));
  404. return(pCPSUIHdrX->pfnNext((PCOMPROPSHEETUIHEADER)pCPSUIHdrX, NULL));
  405. }
  406. return(cPages);
  407. }
  408. LONG
  409. CALLBACK
  410. CommonPropSheetUIFunc(
  411. PPROPSHEETUI_INFO pPSUIInfo,
  412. LPARAM lParam
  413. )
  414. /*++
  415. Routine Description:
  416. This is main entry for old DrvDocumentProperties() and
  417. DrvAdvanceDocumentProperties() which using the new common UI functions
  418. Arguments:
  419. pPSUIInfo - Pointer to the PROPSHEETUI_INFO data structure
  420. lParam - LPARAM for this call, it is a pointer to the
  421. PROPSHEETUI_INFO_HEADER
  422. Return Value:
  423. LONG
  424. Author:
  425. 02-Feb-1996 Fri 14:39:15 created -by- Daniel Chou (danielc)
  426. Revision History:
  427. --*/
  428. {
  429. PCPSUIHDRX pCPSUIHdrX;
  430. PPROPSHEETUI_INFO_HEADER pPSUIInfoHdr;
  431. if ((!pPSUIInfo) ||
  432. (!(pCPSUIHdrX = (PCPSUIHDRX)pPSUIInfo->lParamInit))) {
  433. CPSUIASSERT(0, "ComPropSheetUI: Pass a NULL pPSUIInfo", FALSE, 0);
  434. SetLastError(ERROR_INVALID_DATA);
  435. return(-1);
  436. }
  437. switch (pPSUIInfo->Reason) {
  438. case PROPSHEETUI_REASON_INIT:
  439. pPSUIInfo->Result = pCPSUIHdrX->Result;
  440. pCPSUIHdrX->hParent = pPSUIInfo->hComPropSheet;
  441. pCPSUIHdrX->pfnCPS = pPSUIInfo->pfnComPropSheet;
  442. return(AddOldCPSUIPages(pCPSUIHdrX,
  443. (pPSUIInfo->Flags & PSUIINFO_UNICODE)));
  444. case PROPSHEETUI_REASON_GET_INFO_HEADER:
  445. if (!(pPSUIInfoHdr = (PPROPSHEETUI_INFO_HEADER)lParam)) {
  446. CPSUIERR(("GET_INFO_HEADER: Pass a NULL pPSUIInfoHdr"));
  447. return(-1);
  448. }
  449. pPSUIInfoHdr->Flags = pCPSUIHdrX->Hdr.Flags;
  450. pPSUIInfoHdr->pTitle = pCPSUIHdrX->Hdr.pTitle;
  451. pPSUIInfoHdr->hWndParent = pCPSUIHdrX->Hdr.hWndParent;
  452. pPSUIInfoHdr->hInst = pCPSUIHdrX->Hdr.hInst;
  453. pPSUIInfoHdr->IconID = pCPSUIHdrX->Hdr.IconID;
  454. break;
  455. case PROPSHEETUI_REASON_SET_RESULT:
  456. //
  457. // Save the result and propagate it to the owner
  458. //
  459. pPSUIInfo->Result = ((PSETRESULT_INFO)lParam)->Result;
  460. return(1);
  461. case PROPSHEETUI_REASON_DESTROY:
  462. return(1);
  463. }
  464. }
  465. LONG
  466. DoCommonPropSheetUI(
  467. PCOMPROPSHEETUIHEADER pCPSUIHdr,
  468. _COMPROPSHEETUIFUNC pfnNext,
  469. BOOL AnsiCall
  470. )
  471. /*++
  472. Routine Description:
  473. This is the main entry point to the common UI
  474. Arguments:
  475. Return Value:
  476. LONG
  477. <0: Error occurred (Error Code of ERR_CPSUI_xxxx)
  478. =0: User select 'Cancel' button (CPSUI_CANCEL)
  479. >0: User select 'Ok' button (CPSUI_OK)
  480. Author:
  481. 28-Aug-1995 Mon 16:21:42 created -by- Daniel Chou (danielc)
  482. Revision History:
  483. --*/
  484. {
  485. WORD cPages;
  486. if ((!pCPSUIHdr) ||
  487. (pCPSUIHdr->cbSize != sizeof(COMPROPSHEETUIHEADER))) {
  488. return(ERR_CPSUI_INVALID_PDATA);
  489. }
  490. if (!pCPSUIHdr->hInst) {
  491. return(ERR_CPSUI_NULL_HINST);
  492. }
  493. if ((!(cPages = pCPSUIHdr->cPages)) ||
  494. ((cPages) && (pCPSUIHdr->hPages[cPages - 1] != NULL))) {
  495. CPSUIHDRX CPSUIHdrX;
  496. LONG Result;
  497. LONG Ret;
  498. //
  499. // This is the first time around
  500. //
  501. CPSUIDBG(DBG_DOCPSUI, ("DoComPropSheetUI: FIRST time call"));
  502. CPSUIHdrX.Hdr = *pCPSUIHdr;
  503. CPSUIHdrX.pfnNext = pfnNext;
  504. CPSUIHdrX.hParent = NULL;
  505. CPSUIHdrX.pfnCPS = NULL;
  506. CPSUIHdrX.Result = CPSUI_CANCEL;
  507. if ((Ret = DoCommonPropertySheetUI(CPSUIHdrX.Hdr.hWndParent,
  508. CommonPropSheetUIFunc,
  509. (LPARAM)&CPSUIHdrX,
  510. (LPDWORD)&Result,
  511. AnsiCall)) >= 0L) {
  512. Ret = Result;
  513. }
  514. CPSUIDBG(DBG_DOCPSUI, ("DoCommonPropSheetUI() = %ld", Ret));
  515. return(Ret);
  516. } else {
  517. CPSUIDBG(DBG_DOCPSUI, ("DoComPropSheetUI: Second+ time call"));
  518. ((PCPSUIHDRX)pCPSUIHdr)->pfnNext = pfnNext;
  519. return(AddOldCPSUIPages((PCPSUIHDRX)pCPSUIHdr, !AnsiCall));
  520. }
  521. }
  522. COMPROPSHEETUIFUNC
  523. CommonPropSheetUIW(
  524. PCOMPROPSHEETUIHEADER pComPropSheetUIHdr,
  525. _COMPROPSHEETUIFUNC pfnNext
  526. )
  527. /*++
  528. Routine Description:
  529. This is the main entry point to the common printer property sheet
  530. user interface.
  531. Arguments:
  532. pComPropSheetUIHdr - Pointer to the COMPROPSHEETUIHEADER structure.
  533. * The pData in this structure must be a valid
  534. pointer to the COMPROPSHEETUI structure
  535. pfnNext - a _COMPROPSHEETUIFUNC pointer. This is the pointer
  536. to the next CommonPropSheetUI function, when this
  537. function finished adding property sheets to the
  538. COMPROPSHEETUIHEADER structure, it will call this
  539. function pointer.
  540. if this function pointer is NULL then it will add its
  541. own property sheet pages to the COMPROPSHEETUIHEADER
  542. and then call PropertySheet() function to pop up the
  543. proerty sheet UI
  544. Return Value:
  545. <0: Error occurred (Return value is error code ERR_CPSUI_xxxx)
  546. =0: User select 'Cancel' button (CPSUI_OK)
  547. >0: User select 'Ok' button (CPSUI_CANCEL)
  548. Author:
  549. 01-Sep-1995 Fri 12:29:10 created -by- Daniel Chou (danielc)
  550. Revision History:
  551. --*/
  552. {
  553. LONG Result;
  554. Result = DoCommonPropSheetUI(pComPropSheetUIHdr, pfnNext, FALSE);
  555. if (Result < 0) {
  556. CPSUIERR(("CommonPropSheetUIW() = %ld", Result));
  557. } else {
  558. CPSUIINT(("CommonPropSheetUIW() = %ld", Result));
  559. }
  560. return(Result);
  561. }
  562. COMPROPSHEETUIFUNC
  563. CommonPropSheetUIA(
  564. PCOMPROPSHEETUIHEADER pComPropSheetUIHdr,
  565. _COMPROPSHEETUIFUNC pfnNext
  566. )
  567. /*++
  568. Routine Description:
  569. This is the main entry point to the common printer property sheet
  570. user interface.
  571. Arguments:
  572. pComPropSheetUIHdr - Pointer to the COMPROPSHEETUIHEADER structure.
  573. * The pData in this structure must be a valid
  574. pointer to the COMPROPSHEETUI structure
  575. pfnNext - a _COMPROPSHEETUIFUNC pointer. This is the pointer
  576. to the next CommonPropSheetUI function, when this
  577. function finished adding property sheets to the
  578. COMPROPSHEETUIHEADER structure, it will call this
  579. function pointer.
  580. if this function pointer is NULL then it will add its
  581. own property sheet pages to the COMPROPSHEETUIHEADER
  582. and then call PropertySheet() function to pop up the
  583. proerty sheet UI
  584. Return Value:
  585. <0: Error occurred (Return value is error code ERR_CPSUI_xxxx)
  586. =0: User select 'Cancel' button (CPSUI_OK)
  587. >0: User select 'Ok' button (CPSUI_CANCEL)
  588. Author:
  589. 01-Sep-1995 Fri 12:29:10 created -by- Daniel Chou (danielc)
  590. Revision History:
  591. --*/
  592. {
  593. LONG Result;
  594. Result = DoCommonPropSheetUI(pComPropSheetUIHdr, pfnNext, TRUE);
  595. if (Result < 0) {
  596. CPSUIERR(("CommonPropSheetUIA() = %ld", Result));
  597. } else {
  598. CPSUIINT(("CommonPropSheetUIA() = %ld", Result));
  599. }
  600. return(Result);
  601. }
  602. #endif