Windows C++ : DocumentProperties() doesn't modify the print settings of StartDocPrinter()

pol9595 0 Reputation points
2024-09-25T10:53:14.9533333+00:00

Hello,

I would like to print on two-sided (duplex),

the complete code is here, can you reproduce it ?

but my HP printer prints one sided.

I allocated the correct size of buffer.

like refer to the Doc:Modify printer settings with the DocumentProperties() Function

Thanks

Windows for business | Windows Client for IT Pros | Devices and deployment | Other
Developer technologies | C++
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 90,686 Reputation points
    2024-09-26T06:38:50.69+00:00

    You don't use the returned DEVMODE

    As MSDN says :" The resulting DEVMODE that is returned to the caller is suitable for other API calls that use DEVMODE buffers such a CreateDC(), SetPrinter(), PrintDlg(), or ResetDC().


  2. pol9595 0 Reputation points
    2024-09-26T10:10:37.04+00:00
    DocumentProperties(NULL
        hPrinter,
        pDevice,
        pDevMode, /* Reuse our buffer for output. */ 
        pDevMode, /* Pass the driver our changes. */ 
        DM_IN_BUFFER | /* Commands to Merge our changes and */ 
        DM_OUT_BUFFER); /* write the result. */
    

    Le DEVMODE is passed to DocumentProperties() which is stored in the spool file.

    but it's ignored by « Hp Smart Universal Printing » driver...

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.