WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Printing Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Sample Code to Get and Set a Printer Combo Box Entry

Keywords: 	 printers list

This finally works for me, both Set and Get. Here is my code, modified from the sample:
;Note: This example designed for Windows 95
AddExtender("wwctl34I.dll")
Run("rundll32.exe", "shell32.dll,Control_RunDLL netcpl.cpl")
;debug(@on)
netwnd=DllHwnd("Print")
cfghwnd= cWndByName(netwnd,"Print")
cbWnd=cWndByID(netwnd,1139)
response=cGetCBText(cbwnd)
response=strreplace(response,@tab,@crlf)
Message("Response",response)
exit

;Note: This example designed for Windows 95
;debug(@on)
AddExtender("wwctl34I.dll")
Run("rundll32.exe", "shell32.dll,Control_RunDLL netcpl.cpl")

netwnd=DllHwnd("Print")
cfghwnd= cWndByName(netwnd,"Print")
cbWnd=cWndbyID(netwnd,1139)
response=cGetCBText(cbwnd)
Printer=ItemLocate("CoStar LabelWriter XL Plus", response, @tab)

if Printer==0
Message("Printer","Not Found")
else
cSetCBItem(cbwnd,Printer)
Message("Printer","Selected")
endif
exit
The trick seems to have been to replace cfghwnd with netwnd in the statement that assigns cbwnd a value. Of course, the Windows anayzer script was crucial. You gave me just enough tips to enable me to figure this out for myself. Thanks for your help and I hope someone else might benefit.
Article ID:   W14165
Filename:   Printer Combo Box Selection.txt
File Created: 2001:03:01:13:19:14
Last Updated: 2001:03:01:13:19:14