Prev: play sound from kernelmode
Next: Printer driver samples
From: Rob Roy on 7 Dec 2006 17:33 Hello, My Win2K/XP UNIDRV-based printer driver has a feature to allow "pausing" (via a MessageBox) the spooler at the beginning of each PAGE of a document. This is needed to allow a user to tear off EACH page when using roll paper. I was able to get this to work for 2K/XP by using the OEMDLL for OEMUNI sample code from the DDK and adding a MessageBox call in the OEMStartPage() function of "ddihook.cpp". On Vista, however, the MessageBox does not work properly. The "Interactive Services" comes up, and you can get to the MessageBox this way. But, obviously, this is undesirable behavior. Viewing the AsyncUI.doc file available on the following MS website, http://www.microsoft.com/whdc/device/print/asyncui.mspx it seems that the solution is to use SplPromptUIInUsersSession() function to display the MessageBox instead. However, I am having problems with this. NOTE: I am currently using the Server 2003 DDK and the XP build environment to create the OEMDLL. Problems: 1. SplPromptUIInUsersSession requires "hPrinter" and "jobId" as parameters. These are seemingly not available from the params passed into OEMStartPage. a. I was able to get access to jobId by writing the same param sent to OEMStartDoc to a global variable. b. So, the problem now is seemingly with hPrinter. Though it appears to be available as "pdevobj->hPrinter", this does not seem to work. SplPromptUIInUsersSession is returning FALSE, and GetLastError() is returning 6, i.e. ERROR_INVALID_HANDLE. c. If I try using "pdevobj->hEngine" instead, this doesn't fail, but it never posts the MessageBox. And, it doesn't seem to actually return. But, it also doesn't keep the print data from getting to the printer either. So, I don't really have any idea what happens in this case. Questions: 1) Is it possible to get access to the hPrinter that SplPromptUIInUsersSession needs? If so, how? 2) Is there a better approach available to posting a MessageBox to the user at the beginning of every page? If so, what is it? NOTE: The GPD file seems to provide a mechanism for this via the *rcPromptMsgID Option Attribute. But, my experience with this years ago was that it didn't work. And, even if it does work, the only options it seems to provide is to post a message at the time the user chooses the feature on the UI (using UISETUP for *PromptTime) or at StartDoc time (using PRTSTARTDOC). There is no way to set this to be displayed at every page of a document as we require. So, I am open to suggestions. Best regards, Rob
|
Pages: 1 Prev: play sound from kernelmode Next: Printer driver samples |