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.

181 lines
3.5 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. prnprop.c
  5. Abstract:
  6. Implementation of DDI entry points:
  7. DrvDevicePropertySheets
  8. PrinterProperties
  9. Environment:
  10. Fax driver user interface
  11. Revision History:
  12. 01/09/96 -davidx-
  13. Created it.
  14. mm/dd/yy -author-
  15. description
  16. --*/
  17. #include "faxui.h"
  18. #include <shellapi.h>
  19. #include <faxreg.h>
  20. LONG
  21. DrvDevicePropertySheets(
  22. PPROPSHEETUI_INFO pPSUIInfo,
  23. LPARAM lParam
  24. )
  25. /*++
  26. Routine Description:
  27. Display "Printer Properties" dialog
  28. Arguments:
  29. pPSUIInfo - Pointer to a PROPSHEETUI_INFO structure
  30. lParam - Pointer to a DEVICEPROPERTYHEADER structure
  31. Return Value:
  32. > 0 if successful, <= 0 if failed
  33. [Note:]
  34. Please refer to WinNT DDK/SDK documentation for more details.
  35. --*/
  36. {
  37. PDEVICEPROPERTYHEADER pDPHdr;
  38. PROPSHEETPAGE psp;
  39. //
  40. // Validate input parameters
  41. //
  42. if (!pPSUIInfo || !(pDPHdr = (PDEVICEPROPERTYHEADER) pPSUIInfo->lParamInit)) {
  43. Assert(FALSE);
  44. return -1;
  45. }
  46. //
  47. // Handle various cases for which this function might be called
  48. //
  49. switch (pPSUIInfo->Reason) {
  50. case PROPSHEETUI_REASON_INIT:
  51. //
  52. // "Printer Properties" dialog only has one dummy tab
  53. //
  54. memset(&psp, 0, sizeof(psp));
  55. psp.dwSize = sizeof(PROPSHEETPAGE);
  56. psp.hInstance = ghInstance;
  57. psp.lParam = 0;
  58. psp.pszTemplate = MAKEINTRESOURCE(IDD_USER_INFO);
  59. psp.pfnDlgProc = UserInfoDlgProc;
  60. if (pPSUIInfo->pfnComPropSheet(pPSUIInfo->hComPropSheet,
  61. CPSFUNC_ADD_PROPSHEETPAGE,
  62. (LPARAM) &psp,
  63. 0))
  64. {
  65. pPSUIInfo->UserData = 0;
  66. pPSUIInfo->Result = CPSUI_CANCEL;
  67. return 1;
  68. }
  69. break;
  70. case PROPSHEETUI_REASON_GET_INFO_HEADER:
  71. { PPROPSHEETUI_INFO_HEADER pPSUIHdr;
  72. pPSUIHdr = (PPROPSHEETUI_INFO_HEADER) lParam;
  73. pPSUIHdr->Flags = PSUIHDRF_PROPTITLE | PSUIHDRF_NOAPPLYNOW;
  74. pPSUIHdr->pTitle = pDPHdr->pszPrinterName;
  75. pPSUIHdr->hInst = ghInstance;
  76. pPSUIHdr->IconID = IDI_CPSUI_FAX;
  77. }
  78. return 1;
  79. case PROPSHEETUI_REASON_SET_RESULT:
  80. pPSUIInfo->Result = ((PSETRESULT_INFO) lParam)->Result;
  81. return 1;
  82. case PROPSHEETUI_REASON_DESTROY:
  83. return 1;
  84. }
  85. return -1;
  86. }
  87. BOOL
  88. PrinterProperties(
  89. HWND hwnd,
  90. HANDLE hPrinter
  91. )
  92. /*++
  93. Routine Description:
  94. Displays a printer-properties dialog box for the specified printer
  95. Arguments:
  96. hwnd - Identifies the parent window of the dialog box
  97. hPrinter - Identifies a printer object
  98. Return Value:
  99. If the function succeeds, the return value is TRUE.
  100. If the function fails, the return value is FALSE.
  101. [Note:]
  102. This is the old entry point for the spooler. Even though
  103. no one should be using this, do it for compatibility.
  104. --*/
  105. {
  106. DEVICEPROPERTYHEADER devPropHdr;
  107. DWORD result;
  108. memset(&devPropHdr, 0, sizeof(devPropHdr));
  109. devPropHdr.cbSize = sizeof(devPropHdr);
  110. devPropHdr.hPrinter = hPrinter;
  111. devPropHdr.pszPrinterName = NULL;
  112. //
  113. // Decide if the caller has permission to change anything
  114. //
  115. if (! SetPrinterDataDWord(hPrinter, PRNDATA_PERMISSION, 1))
  116. devPropHdr.Flags |= DPS_NOPERMISSION;
  117. CallCompstui(hwnd, DrvDevicePropertySheets, (LPARAM) &devPropHdr, &result);
  118. return result > 0;
  119. }