>>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.