Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
I modified my code to manually broadcast to OS regarding change in printer to assist in resolving issues with apps that do not seem to pick up the print change correctly. It sends broadcast two different ways.
; Required parameters for printer broadcast string PrinterBroadcastString=strcat(Printer_Share, "," , PRT_PORT, "," , sp_unc) ; Set the default Windows printer DMC=27 ; device="HP DeskJet 500,HPDSKJET,LPT1:" DaDll=Strcat(DirWindows(1),"USER32.DLL") DllCall( DaDll, long:"SendMessageA", long:-1, long:DMC, long:0, lpstr:"%printerbroadcaststring%") ;; this is the WM_WININICHANGE part WININICHG=26 DaDll=Strcat(DirWindows(1),"USER32.DLL") DllCall( DaDll, long:"SendMessageA", long:-1, long:WININICHG, long:0, lpstr:"%printerbroadcaststring%")Any Ideas how we can resolve this issue?
For older versions, you could use this code which specifically calls the SetDefaultPrinter API, if you are running on NT, 2000,and XP. Otherwise is calls pSetDefPrt.
AddExtender("WWPRT34i.DLL") printers = pGetPrtList(0) printer =AskItemList("Choose Default Printer", printers, @tab, @sorted, @single) if WinVersion(1)==5 ;2000/XP ;BOOL SetDefaultPrinter( ; LPCTSTR pszPrinter // default printer name ;); DaDll=Strcat(DirWindows(1),"winspool.drv") ret = DllCall( DaDll, long:"SetDefaultPrinterA", lpstr:printer) if ret==0 Message("Error: Unable to set default printer",DllLastError()) exit endif else ;95/98/ME ret = pSetDefPrt(printer) if !=1 Message("Error: Unable to set default printer",pGetErrorCode()) exit endif endif
Article ID: W15856
File Created: 2004:03:30:15:41:12
Last Updated: 2004:03:30:15:41:12