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

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,719 questions
Windows Hardware Performance
Windows Hardware Performance
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
1,613 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 85,116 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.