Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Setting the default printer
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00179493
Message ID:
00182741
Views:
25
>I would like to know an API call or other method to change the default printer from within VFP 5.0 prior to running an external program that will then use the new default printer. Set printer works fine within VFP, but the other program, Hotdocs, still sees the default printer.

Kent,

You might want to try the "old-fashioned" way. By that I mean changing the setting in the WIN.INI file. The default printer is shown in the [windows] section with device=

I've got a class you can download (IniFiles) in the Win32 and Other APIs section. Use the class to retrieve the current setting of the default printer. The format is generally: Printer Name,Driver,OutputDevice. You can retrieve the printers that have been installed on the computer from the [PrinterPorts} section. They're listed by name and have the driver and output device to the right of the equal sign.

Anyway, you can use the IniFiles class to retrieve the information you need, update the WIN.INI file and then restore it. The class will take care of telling any open applications to reload the necessary section.
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform