Page 1 of 1

Device Context

Posted: Fri Aug 07, 2009 12:35 pm
by ConvertFromOldNGs
by Scott >> Thu, 10 Jun 2004 23:04:28 GMT

Hi all - Is there a way to obtain a device context for a printer in JADE (other than using the CMDPrint dialog)?

Thanks

Re: Device Context

Posted: Fri Aug 07, 2009 12:35 pm
by ConvertFromOldNGs
by Jade Support >> Fri, 11 Jun 2004 4:17:47 GMT

Unfortunately you cannot access the printer device context directly from JADE logic, calling Windows APIs is the only way. (Note that the CMDPrint dialog returned DC is not the one JADE uses).

The following Windows APIs may be useful...

External Function Definitions:

createDC(
lpszDriver,
lpszDevice : String;
lpszOutput : Integer;
lpInitData : Binary) : Integer is CreateDCA in gdi32;

deleteDC(hdc : Integer) : Integer is DeleteDC in gdi32;


Example:

vars
hdc,
result : Integer;begin

hdc := call createDC('WINSPOOL', app.printer.getPrinterName(), 0, 0);
result := call deleteDC(hdc);
end;