views:

70

answers:

2

Hi

I'm having trouble with the dmColor field fo the DEVMODE structure.

My default printer is a color printer, if I default output color of the printer properties through the control panel to black and white the DEVMODE.dmColor field always returns DMCOLOR_COLOR instead of DMCOLOR_MONOCHROME.

Even if I default my printer to a black and white only printer, DEVMODE.dmColor still always returns DMCOLOR_COLOR

All of the other DEVMODE fields such as dmDeviceName, dmCopies, dmDuplex, etc work fine. I have also tried to query DC_COLORDEVICE using the DeviceCapabilities function, microsoft documentation says it should return 1 if the device supports color, 0 if it does not and -1 if an error occured. This function is always returning -1 but the error code returned by GetLastError translates to "The operation completed successfully".

I'm running under windows Vista and I have specified DM_COLOR in DEVMODE.dmFields, does anyone know why this happens?

Thank you.

A: 

This might be a driver issue.

I'm having the exactly opposite on my HP 2840 color multifunctional: the XP specific drivers work well (allowing both color and monochrome), but they are not supported on Vista and higher.
From Vista on, you need to use the Generic HP drivers, which always return monochrome.

--jeroen

Jeroen Pluimers
+1  A: 

I've solved the issue, it seems like the color setting along with other settings are stored in the private drive data section below the DEVMODE structure. The size of the private data is stored in DEVMODE.dmDriverExtra. Copying the private driver data returned from the printer properties dialog box to the printing device has fixed the problem.

no spoon