Board index » cppbuilder » DEVMODE and OWL printing

DEVMODE and OWL printing


2004-02-13 12:21:53 AM
cppbuilder46
Hi. Perhaps someone can help me. I'm using OWL 2.5 and I have an HP Laserjet
Series 8000 PCL printer.
When I use the "Pages per Sheet" feature in the printer setup, it appears to
be ignored.
The printer can do multiple pages-per-sheet from other apps like Word, etc.
but not with OWL it seems.
Is there a bug in OWL about this? I know from examining the DEVMODE
structure that the pages-per-sheet setting is contained in the dependent, or
private, portion of the structure (for this type of printer). All other
aspects of printing seem to be ok. Does anyone have some ideas on this?
Thanks!
John
 
 

Re:DEVMODE and OWL printing

I don't know if this is your problem or not, but I ran into an interesting
problem the other day. My OWL program uses classes derived from TPrinter
and TPrintout. When you print using the TPrinter::TPrint method, TPrint
checks to see how many copies the printer can print at a time. The variable
is copiesPerPass. This variable was given a value of zero, and this
resulted in an infinite loop that really filled up the print queue.
To fix this, you can create a subclass of TPrinter and copy the TPrint()
method from the source file. Add the line if (copiesPerPass <= 0)
copiesPerPass=1; after the call to SetCopyCount.
I don't know what version of OWL I use, but it came with Borland C++ 5.01.
Also, the problem occurred on a Windows XP system with something like a
Cannon i560 printer.
 

Re:DEVMODE and OWL printing

A couple of my clients have been having trouble printing and I thought
it might was something to do with the DEVMODE structure. So I check to
see if there was difference in the BCPP 5.02 DEVMODE and the newest MS
DEVMODE. There was a slight difference in the two so I modified the
"wingdi.h" file:
/* fix to use ms devmode structure */
#ifdef USE_BCPP_DEVMODE
typedef struct _devicemodeA {
BYTE dmDeviceName[CCHDEVICENAME];
WORD dmSpecVersion;
WORD dmDriverVersion;
WORD dmSize;
WORD dmDriverExtra;
DWORD dmFields;
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
short dmScale;
short dmCopies;
short dmDefaultSource;
short dmPrintQuality;
short dmColor;
short dmDuplex;
short dmYResolution;
short dmTTOption;
short dmCollate;
BYTE dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
DWORD dmDisplayFlags;
DWORD dmDisplayFrequency;
DWORD dmICMMethod;
DWORD dmICMIntent;
DWORD dmMediaType;
DWORD dmDitherType;
DWORD dmICCManufacturer;
DWORD dmICCModel;
DWORD dmPanningWidth;
DWORD dmPanningHeight;
} DEVMODEA, *PDEVMODEA, *NPDEVMODEA, *LPDEVMODEA;
typedef struct _devicemodeW {
WCHAR dmDeviceName[CCHDEVICENAME];
WORD dmSpecVersion;
WORD dmDriverVersion;
WORD dmSize;
WORD dmDriverExtra;
DWORD dmFields;
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
short dmScale;
short dmCopies;
short dmDefaultSource;
short dmPrintQuality;
short dmColor;
short dmDuplex;
short dmYResolution;
short dmTTOption;
short dmCollate;
WCHAR dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
DWORD dmDisplayFlags;
DWORD dmDisplayFrequency;
DWORD dmICMMethod;
DWORD dmICMIntent;
DWORD dmMediaType;
DWORD dmDitherType;
DWORD dmICCManufacturer;
DWORD dmICCModel;
DWORD dmPanningWidth;
DWORD dmPanningHeight;
} DEVMODEW, *PDEVMODEW, *NPDEVMODEW, *LPDEVMODEW;
#else
typedef struct _devicemodeA {
BYTE dmDeviceName[CCHDEVICENAME];
WORD dmSpecVersion;
WORD dmDriverVersion;
WORD dmSize;
WORD dmDriverExtra;
DWORD dmFields;
union {
struct {
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
};
POINTL dmPosition;
};
short dmScale;
short dmCopies;
short dmDefaultSource;
short dmPrintQuality;
short dmColor;
short dmDuplex;
short dmYResolution;
short dmTTOption;
short dmCollate;
BYTE dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
union {
DWORD dmDisplayFlags;
DWORD dmNup;
};
DWORD dmDisplayFrequency;
#if(WINVER>= 0x0400)
DWORD dmICMMethod;
DWORD dmICMIntent;
DWORD dmMediaType;
DWORD dmDitherType;
DWORD dmReserved1;
DWORD dmReserved2;
DWORD dmPanningWidth;
DWORD dmPanningHeight;
#endif /* WINVER>= 0x0400 */
} DEVMODEA, *PDEVMODEA, *NPDEVMODEA, *LPDEVMODEA;
typedef struct _devicemodeW {
WCHAR dmDeviceName[CCHDEVICENAME];
WORD dmSpecVersion;
WORD dmDriverVersion;
WORD dmSize;
WORD dmDriverExtra;
DWORD dmFields;
union {
struct {
short dmOrientation;
short dmPaperSize;
short dmPaperLength;
short dmPaperWidth;
};
POINTL dmPosition;
};
short dmScale;
short dmCopies;
short dmDefaultSource;
short dmPrintQuality;
short dmColor;
short dmDuplex;
short dmYResolution;
short dmTTOption;
short dmCollate;
WCHAR dmFormName[CCHFORMNAME];
WORD dmLogPixels;
DWORD dmBitsPerPel;
DWORD dmPelsWidth;
DWORD dmPelsHeight;
union {
DWORD dmDisplayFlags;
DWORD dmNup;
};
DWORD dmDisplayFrequency;
#if(WINVER>= 0x0400)
DWORD dmICMMethod;
DWORD dmICMIntent;
DWORD dmMediaType;
DWORD dmDitherType;
DWORD dmReserved1;
DWORD dmReserved2;
DWORD dmPanningWidth;
DWORD dmPanningHeight;
#endif /* WINVER>= 0x0400 */
} DEVMODEW, *PDEVMODEW, *NPDEVMODEW, *LPDEVMODEW;
#endif // USE_BCPP_DEVMODE
I just did this modification and it works on all the systems I have here
to test them on. I still don't know if it will correct the problem
that my clients are experiencing. Please let me know if this fixes your
problem.
Steve
 

{smallsort}