Page 1 of 1

Printer Forms Manager

Posted: Sun Mar 05, 2017 12:17 pm
by rdonnay
Here is the source for a utility that lets you Add, Change or Delete printer forms.
http://bb.donnay-software.com/donnay/PrinterForms.Prg

It uses the following Windows API calls:

Code: Select all

DLLFUNCTION AddFormA( hPrinter, nLevel, sForm ) USING STDCALL FROM WINSPOOL.DRV

DLLFUNCTION OpenPrinterA( cPrinterName, @hPrinter, sDefaults ) USING STDCALL FROM WINSPOOL.DRV

DLLFUNCTION ClosePrinter( hPrinter ) USING STDCALL FROM WINSPOOL.DRV

DLLFUNCTION SetFormA( hPrinter, cFormName, nLevel, sForm ) USING STDCALL FROM WINSPOOL.DRV

DLLFUNCTION GetLastError() USING STDCALL FROM KERNEL32.DLL

DLLFUNCTION DeleteFormA( hPrinter, cFormName ) USING STDCALL FROM WINSPOOL.DRV
PrinterForms.JPG
PrinterForms.JPG (233.31 KiB) Viewed 7556 times

Re: Printer Forms Manager

Posted: Mon Mar 06, 2017 1:08 am
by unixkd
Hi Roger

Very nice tool.

Is it possible to add a Button that can call up the :setupDialog() for each printer, modify the printer properties and save it back for subsequent use.

Thanks

Joe

Re: Printer Forms Manager

Posted: Mon Mar 06, 2017 7:49 am
by rdonnay
add a Button that can call up the :setupDialog()

Code: Select all

@ DCGUI_ROW, DCGUI_COL + 10 DCPUSHBUTTON CAPTION 'Printer Properties' SIZE 20,1.2 ;
       ACTION {|o|o := XbpPrinter():new():create(cPrinterName):setupDialog(), o:destroy()}
I updated the source at http://bb.donnay-software.com/donnay/printerforms.prg.

Re: Printer Forms Manager

Posted: Wed Mar 08, 2017 12:13 am
by unixkd
Hi Roger

Thanks for the response.

One more thing. The properties setting are not saved when it is edited/updated and the OK button is clicked in the properties page.

Joe

Re: Printer Forms Manager

Posted: Wed Mar 08, 2017 8:00 am
by rdonnay
The properties setting are not saved
There is nothing i can do about that.
Why don't you give it a try.