Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get the Windows current/default printer?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00587786
Message ID:
00588968
Vues:
32
Thanks, I'll try it.


Luis


>If the value (Default as opposed to (Default))doesn't exist in the key in the registry (as it does, apparently, in both our cases, since I get an error as well), it gets a bit tougher just finding the printer names, let alone the default. Unfortunately, under Win2K, the information is no longer in Win.Ini...or so it looks. The code below utilizes my IniFiles object (which is available in the UT download section). Since I just tried this, I know it works.
SET PROCEDURE TO IniFiles ADDITIVE
>oIni = CREATEOBJECT("Ini_Files")
>? oIni.GetIniEntry("WINDOWS", "DEVICE")
Now even though there's no such entry in my WIN.INI file, it returned the proper value. Further, since the printer driver's file name was also stored in WIN.INI, it wouldn't surprise me if you could get that as well using a similar call.
>
>The disclaimer here is that this works for reasons of compatibility with 16 bit apps. The reason it works is that the calls to GetProfileString also map to the registry. How long such support will last is problematical.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform