Here's a local proc I wrote to get a list of printers. I take this list and put it in a drop down box. Hope this might help.
entry c_get_printer_list
params
string p_printer_list : OUT
endparams
variables
string v_ssid_key, v_prt_lst_key
string v_ssid, v_ssids, v_item
string v_prt_lst
string v_printer, v_port, v_driver, v_ext
string v_printer_list
string v_redirect1, v_redirect2
boolean v_continue
endvariables
v_ssid_key = "HKEY_CURRENT_USER\Remote"
v_prt_lst_key = "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts"
;first see if this is a remote session, only values above 2 are valid
v_ssids = $setting("", "%%v_ssid_key%%%\·*", "REGKEYS")
if (v_ssids != "")
;go through each session (should really only be one
forlist v_item in v_ssids
v_ssid = v_item
if (v_ssid != "")
break
endif
endfor
endif
;now get list of printers
v_prt_lst = $setting("", "%%v_prt_lst_key%%%\·*", "REGVALUES")
if (v_prt_lst != "")
;go through each session (should really only be one
forlist v_item in v_prt_lst
v_printer = $idpart(v_item)
v_continue = "T"
;see if this priter is for this session
if (v_ssid+0 > 1)
v_redirect1 = "(redirected"
;if redirect not found, then it's a local printer
if ($scan(v_printer, v_redirect1) > 0)
v_redirect2 = "(redirected %%v_ssid%%%)"
if ($scan(v_printer, v_redirect2) = 0)
v_continue = "F"
endif
endif
endif
if (v_continue)
v_ext = $setting("", "%%v_prt_lst_key%%%\%%v_printer%%%", "REGDATA")
v_ext = $replace(v_ext,1, ",","·;",-1)
;example is winspool,TS002,15,45
getitem v_port, v_ext, 2
getitem v_driver, v_ext, 1
v_printer="%%v_printer%%%;%%v_port%%%;%%v_driver%%%;0"
if (v_printer_list = "")
v_printer_list = v_printer
else
;add a newline and then the printer
;v_printer_list = "%%v_printer_list%%%%%^"
;v_printer_list = "%%v_printer_list%%%%%v_printer%%%"
v_printer_list = "%%v_printer_list%%%·;%%v_printer%%%"
endif
endif
endfor
endif
sort/list v_printer_list
p_printer_list = $replace(v_printer_list,1,"·;","%%^",-1)
return 0
end ;c_get_printer_list
------------------------------
David Pontius
Systems Analyst
AFS Technologies Inc
Tampa FL US
------------------------------
Original Message:
Sent: 05-03-2022 15:30
From: Tim Colvin
Subject: Windows Print Dialog from Uniface 10
Is there a way to call the Windows Print Dialog box and have it return the selected printer and properties selected?
In our switch to Uniface 10, we are exploring new reporting options. Previously all printer queue selections went through our report controls, but those controls are no longer available. I'd prefer to use native windows dialog boxes if at all possible. All we do is select printers so we can pass them off to our reporting solution for printing. There's nothing being directly printed in Uniface.
------------------------------
Tim Colvin
Smyth Retail Systems Inc.
Alliance OH US
------------------------------