How to show printer properties/preferences dialog and save changes?

后端 未结 4 630
日久生厌
日久生厌 2020-12-09 00:23

EDIT: My fault! I expected the changes to be written back to the default printer settings when in fact only the local instance of the PrinterSettings are changed. -

4条回答
  •  星月不相逢
    2020-12-09 00:34

    • when your application started up:
      • have you queried the printer driver for the correct size of the DEVMODE structure before allocating it?
      • have you asked the device driver to initialize the DEVMODE buffer with the default settings after you have allocated it?
    • when your application popped up the printer dialog:
      • have you set the DM_IN_BUFFER and DM_OUT_BUFFER flags (in addition to DM_IN_PROMPT) in the fMode parameter to DocumentProperties?
      • have you pointed both pDevModeInput and pDevModeOutput to the DEVMODE buffer you initialized at application startup?
      • are the dmFields bits in the DEVMODE buffer properly set prior to your calling DocumentProperties(... DM_IN_PROMPT ...)
      • are you preserving the contents of the DEVMODE buffer in between calls to DocumentProperties(... DM_IN_PROMPT ...)?

    See:

    • How To Modify Printer Settings with the DocumentProperties() Function
    • Using the Document Properties Dialog Box
    • the DocumentProperties Function

提交回复
热议问题