I want to get the document name of the print document.

Suzuki, Masato/鈴木 正登 20 Reputation points
2023-04-25T09:51:30.54+00:00

I'm developing a user-mode virtual printer driver based on the WDK bitmap sample. sample:  WinDDK\7600.16385.1\src\print\oemdll\bitmap Is there a way to get the print document name inside the OEMEndDoc function? OEMEndDoc has two input parameters (SURFOBJ, FLONG), but I couldn't find the print document name.

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,585 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,567 questions
{count} votes

Accepted answer
  1. Limitless Technology 44,036 Reputation points
    2023-04-26T11:59:53.9933333+00:00

    Hi, I'd be happy to help you out with your question. Sorry for the inconvenience caused. In regards to obtaining the print document name in the OEMEndDoc function, Unfortunately, this information is not directly available. However, you can use the information passed to the printer driver via the pwszDocName parameter in the OEMStartDoc function to identify the document name. You can save this value in a global variable or data structure when OEMStartDoc is called and then refer to it in OEMEndDoc to retrieve the print document name. Just keep in mind that OEMStartDoc is called once per print job, while OEMEndDoc is called once per printed page. Therefore, you should save the document name in a location that persists throughout the entire print job, such as a global variable or a shared memory segment. As for your question about handling multiple documents being printed at the same time, OEMStartDoc is called once per print job, and OEMEndDoc is called once per printed page. So, if multiple documents are being printed at the same time, the driver will receive multiple calls to OEMStartDoc and OEMEndDoc. It's up to the driver to manage any necessary state between these function calls. If you have any other questions or need assistance with anything, please don't hesitate to let me know. I'm here to help.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more