2011年12月10日 下午 01:49customer can not change default printer in XP operating system with code for API in vb net, it happens only one machine, why?
2011年12月12日 上午 07:37版主
Welcome to the MSDN Forum.
How many printers are installed in that machine? And what is the code for change the default printer? Please provide more details such as this.
On the other hand, if there are serveral printers in the machine, you can try to reinstall them all again. Or reinstall the OS and add the printers.
I hope this well be helpful.
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已標示為解答 Mike FengMicrosoft Contingent Staff, Moderator 2011年12月20日 下午 03:16
2012年3月19日 上午 06:16
Miilions of apologizes for late reach due to some problems, and thanks for your welcome...
Code is below to change default printer (we are using-Microsoft.VisualBasic.PowerPacks.dll NET v9)
DeviceLine = PrinterName & "," & DriverName & "," & PrinterPort
Call WriteProfileString("windows", "Device", DeviceLine)
Call SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0, "windows")
this results with a message PRINTER ERROR 0.
What is strange other users are not facing this problem in the same network-same printer (may be due different OS or versions of OS).
Thanks a lot.
2012年3月30日 下午 01:06reason was DEVICENAME, it could not be get from PRINTERS COLLECTION by code, may be one of them raised error and sent code out, solved by RESUME ERROR ON NEXT, skipping the one that could not be read...