Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Description of API in win32API
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00272307
Message ID:
00278063
Views:
27
>>Thank you for your previous answer.
>>
>>I am sarching an API to change the default printer setting programmaticaly.
>>
>>Do you know if such an API exists.
>>
>>
>>Thank you for your answer.
>
>Hi Francis,
>
>You'd have to use the following API calls: OpenPrinter(), GetPrinter(), SetPrinter() and ClosePrinter() if doing this strictly in VFP. It really depends on what properties you're trying to set. If they're in a PRINTER_INFO_2 structure's DEVMODE structure, it's complicated since one of the members of the PRINTER_INFO_2 structure is a pointer to the DEVMODE structure. If sticking with VFP, you'd need Vlad Tatavu's Pointers, Ed Rauh's CLSHEAP, or Christof Lange's Structure (from the UT download section) to be able to create the pointer to the DEVMODE.
>
>It'd probably be easier to write a VC++ DLL to wrap this.
>
>Anyway, there's an MS KB article (Q140285) that tell's how to do this from C++.

You can download a nifty program from John Saville's NT FAQ site, which provides a command line method of setting the Windows Default printer - you can fire it with the VFP RUN command, or with a ShellExecute() or CreateProcess() API call (the FFC ShellExecute() class in VFP6, or my API_APPRUN class in the File Section here can handle this for you.) It avoids most of the issues involved in deciding what files/registry entries need to be changed.
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