PowerBuilder Function Set Default Printer

PowerBuilder Function Set Default Printer gf_set_default_printer

Good Luck!

Was this article helpful?
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
xZzz
xZzz
4 months ago

// Get default printer
// Change on other printer
// Print what u need
// Return default printer
// *******************
// Declare Function
Function Long SetDefaultPrinter(string pszPrinter) library ‘winspool.drv’ alias for ‘SetDefaultPrinterA’
Function Boolean GetDefaultPrinter(ref String sPrinter, ref Ulong dwBuffer) library ‘winspool.drv’ alias for ‘GetDefaultPrinterA’

String ls_defPrinter, ls_newPrinter
Ulong lul_buf

lul_buf = 260
ls_defPrinter= space(lul_buf)

if not GetDefaultPrinter(ls_defPrinter, lul_buf) then
return false
end if

// Printer Name – Name of local or shared(network) printer
ls_newPrinter = ‘Printer Name’

// Set New Printer as Default
if SetDefaultPrinter(ls_newPrinter) = 0 then
return false
end if

dw_label.print()

SetDefaultPrinter(ls_defPrinter)

1
0
Would love your thoughts, please comment.x
()
x