Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Default Windows Printer (Strange problem)
Message
From
12/09/2000 04:14:27
 
 
To
11/09/2000 06:22:01
General information
Forum:
Visual Basic
Category:
Windows API functions
Miscellaneous
Thread ID:
00414797
Message ID:
00415296
Views:
20
>Hello.
>I write code for Set default windows printer
>I have strange problem. When I place MSGBOX("Run") in method.. I see.. Default printer was set. But If I rem MSGBOX() the old printer stay as default.
>Can you explain that?


The easy solution is to use the Wscript.Network automation object:

oNet = CREATEOBJ('wscript.network')
oNet.SetDefaultPrinter(Windows Printer Name from AGETPRINTER())

Requires instalation of WSH 2.0 or later; works fine for me, regardless of platform.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform