Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Detecting Windows Default Printer
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00216227
Message ID:
00218641
Vues:
30
>Well here's where we stand...
>I wrote a simple program in VFP which sends the output of
>SET("PRINTER",2) and APRINTERS()
>to a text file.
>
>Now I realize I have only part of the solution.
>
>In 2.6 SET PRINTER TO whatever
>does not alter the windows default printer...just where Fox sends stuff.
>I knew that, honest, but forgot.
>
>I now need help to actually alter the windows default printer setting, using almost any method...except user intervention.
>
Hi Richard,

Basically, what you need to do is:

1. Load Foxtools
2. Register the following API call: GetProfileString(), WriteProfileString(), and SendMessage()
3. Get the current default printer from the device= entry of the windows section using GetProfileString(). This is for restoring later.
4. Use WriteProfileString() to set the new default.
5. Call SendMessage() with HWND_BROADCAST to cause all open apps to reload the section.
6. Repeat the above to restore.

If you want code samples, let me know.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform