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

Printer Controller

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

Connect the Printer and Set the Printer as the Default Printer

Keywords: 	  default printer

The pSetDefPrtEx command requires a printer driver argument and this is difficult to find where the printer is a network printer and driver installation is handled in the background as and when required.

Also, the printer name and printer port turn out to be the same, at least in my local network situation. Here is the code that connects the printer AND sets the printer as the default printer. Thanks for the help....

AddExtender("WWPRT34I.DLL")
result=pAddPrtConn("\\fohsfile01", "fohplp170102")
if result==1
	printername=pGetPrtList(0)

	If ItemCount(printername,@TAB)>1 
		myprn=AskItemList("Select Default Printer", printername, @tab, @sorted, @single)
	else
		myprn=ItemExtract(1,printername,@TAB)
	endif

	ret=pSetDefPrtEx(myprn,"",myprn)
	if ret==1
		display(2,"Printer Connection","Connection to %myprn% successful")
	else
		Message("Printer Connection","Setting %myprn% as default - failed")
	endif
else
	Message("Printer Connection","Connection to %myprn% failed")
endif
exit 

Article ID:   W14191
Filename:   Connect Printer and Set the Default Printer Example.txt
File Created: 2001:03:01:15:38:20
Last Updated: 2001:03:01:15:38:20