How do you control the tray selection for a printer in Windows?

We need to be able to change the selected default print tray for this printer. Does anyone have VC ++ / win32 code for this?

In case that matters, I believe that we should change the default setting for the printer. Our print jobs are performed by an application other than ours, so we cannot make such changes in the context of the print operation originating from our application. If there is any way to change the default print settings in another application, I think we are stuck by changing the default user settings for the printer, initiating our print job, and then setting the default values ​​to the original values.

We would prefer that the default changes change only for the current user and do not require any special increase in UAC, etc.

I suspect that he will use something similar to what is shown in this MSDN article and includes setting fields in the DEVMODE structure (either dmDefaultSource or dmFormName or both).

Any takers? Or does anyone have any mistakes that they would like to share?

EDIT: Here is a link to the DEVMODE documentation DEVMODE documentation

EDIT: I should also indicate that we are looking for a general solution, not something specific for a particular printer (we are deploying in many, many environments)

+5
source share
5 answers

FYI - , , DEVMODE. win32, ( DocumentProperties fMode, DM_IN_PROMPT). DEVMODE . , DEVMODE, DEVMODE, , DEVMODE.

. DEVMODE, .

( ) - , , ..

. , . . , ( DEVMODE). , , - , .

+1

, Microsoft . System.Drawing.Printing.PrinterSettings. PaperSource, , .

, . . : PrinterSettings - ,

, , , , , . ( : 1, 2). . , , .

, , - , , , Postscript PCL , . , .

+1

dmDefaultSource . , , , , , #, .

VB6 . dmDefaultSource # . DeviceCapabilities (, " 1" ), .

http://support.microsoft.com/kb/194789

+1

- , SDK . , , DEVMODE PRINTINFO_ *, , .

. - GUI , AutoIT. -, , , ( ).

0

As far as I know, printers are controlled by the printer driver by sending them SNMP or PJL commands. But not all printers fully implement these commands.

For HP printers, I found: http://h20000.www2.hp.com/bizsupport/TechSupport/Document.jsp?lang=en&cc=us&objectID=bpl07282&jumpid=reg_R1002_USEN some PJL commands (some of them are also associated with the tray).

I am not sure about this help, but I perceive it as a hint for future searches ...

0
source

All Articles