Board index » cppbuilder » DeviceCapabilities DC_MAXEXTENT Fails on HP Laser Jet 1012
Chad Eddy
![]() CBuilder Developer |
DeviceCapabilities DC_MAXEXTENT Fails on HP Laser Jet 10122005-02-11 01:59:41 AM cppbuilder28 I'm not sure what newsgroup to put this to. I am using the DeviceCapabilities function to try to make sure that the user is not trying to print a report (8.5 x 11 size) to a label printer (which would probably just print a ton of labels trying to get a report done) I am checking the maximum page size and if its too small I let them know (and if they want to proceed fine..) This has been working in the past but is failing on the HP Laser Jet 1012 and I don't know if its a problem with the code or something with HP's Driver. If anyone can point me in the right direction that would be great, thanks! Here is the code I am doing: bool BKPRINTERS::GetPrinterMaxSize(int PrinterIndex, double& Height, double& Width) { if(PrinterIndex < 0 || PrinterIndex>= PrinterNameList->Count) return false; LPBYTE Buffer = NULL; DWORD BufferLength; AnsiString PrinterName = PrinterNameList->Strings[PrinterIndex]; AnsiString PrinterPortName = PrinterPortNameList->Strings[PrinterIndex]; BufferLength = DeviceCapabilities(PrinterName.c_str(), PrinterPortName.c_str(), DC_MAXEXTENT, Buffer, NULL); if (BufferLength == (DWORD)-1) // <<<< THIS IS WHERE ITS FAILING / RETURNING -1 return false; Width = LOWORD(BufferLength); Height = HIWORD(BufferLength); return true; } |