Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to change Default printer from VFP under win98
Message
From
28/06/2002 10:24:55
 
 
To
28/06/2002 09:51:29
Xiaodong Yan
Better Database Solutions
Spring, Texas, United States
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00673248
Message ID:
00673274
Views:
17
>Hi,
>
>I use ShellExcute() win API function to print an image file from VFP. Now, user wanted me to send the output to a different paper try. I realized that "Set Printer to Name XXXX" no longer works since SellExcute() always send to the Default printer, no matter what.
>
>Is there a way to change my default printer from VFP?

You can use the Windows Script Host's Wscript.Network SetDefaultPrinter method to do this; there's extensive coverage of this in the 5 part article on the Windows Script Host written by George Tasker and myself back in the late summer and fall of 2001, posted on www.vfug.org - see George's sig block for a reference if you can't find it in their back articles. It's also discussed, albeit from a VB/C++ perspect, in a number of the links in my sig block; the VFP code is extremely similar to the VB code, so you shouldn't have any problems. A sample would be:
oWSHNet - CREATEOBJECT('Wscript.Network')
oWSHNet.SetDefaultPrinter('MyWindowsPrinterName')
>
>Thanks,
>
>~Sheldon
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