Page 1 of 1
How to get list of active printers?
Posted: Tue Oct 28, 2008 7:52 am
by mol
I need to use my program installed on flash pendrive to be used on several computers.I need to test, if selected printer (saved in INI file) is present on machine.
How to get list of printers installed on exact machine?
Marek
PS. I found in other minigui something like that:
private aprinters := {}
INIT PRINTSYS
GET PRINTERS TO aprinters
RELEASE PRINTSYS
but it doesn't work in our HMG 2.6.7
Re: How to get list of active printers?
Posted: Tue Oct 28, 2008 9:23 am
by Roberto Lopez
mol wrote:I need to use my program installed on flash pendrive to be used on several computers.I need to test, if selected printer (saved in INI file) is present on machine.
How to get list of printers installed on exact machine?
Marek
PS. I found in other minigui something like that:
private aprinters := {}
INIT PRINTSYS
GET PRINTERS TO aprinters
RELEASE PRINTSYS
but it doesn't work in our HMG 2.6.7
If you want that the user select a printer for a list with all available, you could use the GetPrinter() function.
If you want to do it yourself, you can use the aPrinters() (internal) function.
Sample:
Code: Select all
cPrinter := GetPrinter()
If Empty (cPrinter)
Return
EndIf
SELECT PRINTER cPrinter ;
ORIENTATION PRINTER_ORIENT_PORTRAIT ;
PAPERSIZE PRINTER_PAPER_LETTER ;
QUALITY PRINTER_RES_MEDIUM
If you prefer to use the default printer:
Code: Select all
SELECT PRINTER DEFAULT ;
ORIENTATION PRINTER_ORIENT_PORTRAIT ;
PAPERSIZE PRINTER_PAPER_LETTER ;
QUALITY PRINTER_RES_MEDIUM
If you want to use the system printer selection dialog:
Code: Select all
SELECT PRINTER DIALOG TO lSuccess
If lSuccess == .T.
PrintDoc()
MsgInfo('Print Finished')
EndIf
The samples at \hmg\samples\print could help you too.
Regards,
Roberto.
Re: How to get list of active printers?
Posted: Tue Oct 28, 2008 10:38 am
by mol
Many thanks Roberto!
I dind't know anything about internal function aPrinters()
That's all I need for my project.
Best regards, Marek
Re: How to get list of active printers?
Posted: Tue Oct 28, 2008 10:51 am
by Roberto Lopez
mol wrote:Many thanks Roberto!
I dind't know anything about internal function aPrinters()
That's all I need for my project.
Best regards, Marek
OOPS!...
I've documented aPrinters(). It is in \hmg\doc\print.html.
I've said 'internal' because I've added to be used by GetPrinter() function and I not use it directly.
Anyway... its early in the morning here and I've not drink my first coffee yet
![Smile :)](./images/smilies/icon_e_smile.gif)
...
I must avoid to answer messages prior to breakfast
Regards,
Roberto.