Re: Enable "Hex Input Mode" via C++
 
windsim wrote:
I have a Epson voucher printer installed as win-printer on my PC. I
just wonder how I can enable "Hex Input Mode"  which is under Control
Panel\\Printers and Faxes\\Epson_printers Properties via a c++ program
instead of clicking the checkbox of "Hex Input Mode" manually? Is
there any Windows API call I can use?
SetPrinter with level 2. First call GetPrinter to fill in PRINTER_INFO_2 
structure, then modify pDevMode to taste, and finally call SetPrinter to 
update settings.
The trick is to figure out where in DEVMODE this setting is stored. 
DEVMODE structure consists of two parts: common part as documented in 
MSDN, and undocumented driver-specific part comes right after that. You 
could play with DocumentProperties to try and figure out where this 
particular driver puts this particular setting. Write a test program 
that uses DocumentProperties to show printer properties dialog, then 
hex-dumps the resulting DEVMODE (remember to write the private bytes 
beyond DEVMODE proper). Run it twice to save two dumps, one with the 
setting in question checked and the other unchecked, all other settings 
being equal. Compare the two dumps: hopefully, the difference will tell 
you where to set the option programmatically.
-- 
With best wishes,
    Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not 
necessarily a good idea. It is hard to be sure where they are going to 
land, and it could be dangerous sitting under them as they fly 
overhead. -- RFC 1925