I am working on a project where I need to program for print operations from device. It has WIN CE 6.0. I am using Visual Studio 2005 (MFC). The printer can be any PCL-compatible printer.
Currently, to get printer DC, I am using CreateDC().
hPrinterDC = CreateDC(L"PCL.DLL", L"Any Name", L"LPT1", NULL);
Using this call I am able to print successfully. Here I am passing DEVMODE specific input parameter as NULL. But for having finer control over these print operations, I need to pass DEVMODE information to CreateDC().
For that I am planning to make a call to CreateDC() as specified above to generate DEVMODE specific information in the registry. I can then read this DEVMODE data from registry into local variable, modify only necessary fields of this variable, and pass this variable to CreateDC() to get printer DC for actual print operations to follow.
I am avoiding direct initialization of DEVMODE struct, as I don't have enough information about certain fields of DEVMODE e.g. dmDriverExtra.
I need to know how can I safely read a struct like DEVMODE from registry? Any relative example will be really helpful.
Kind Regards, Aftab