Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


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