Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP 3.0 Current Printer
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00068391
Message ID:
00068588
Vues:
41
>>Hi Sonali,>>Check out the GETPRINTER() function. It returns the current printer.>>Kamal>>>In VFP 3.0 how is it possible to determine the Current Printer>>>>Thanks and Happy New Year>>>>SonaliHi! GETPRINTER() function opens up a dialouge box and then you haveto press enter/escape to exit. You can stuff the keyboard and get thecurrent printer but that is really an indirect method.Is there any more direct method.ThanksSonali

Sonali,

In both Win 3.1 and Win 95, the current default printer can be found in the WIN.INI file in the [windows] section's device= entry. You can retrieve this using the API call GetProfileString. Further, you might want to check your FOXTOOLS.FLL library for GetProStrg. This function is in the version that comes with VFP 5.0, but I'm not sure about 3.0. Depending on which version of windows VFP is compiled under, the syntax would be one of the following:

Win 3.1

m.getpro = RegFN("GetProfileString", "CCC@CI", "I")
m.buffer = SPACE(200)
m.buflen = LEN(m.buffer)
m.buflen = CallFN(m.getpro, "windows", "device", "", @bufffer, m.buflen)

Win 95

DECLARE INTEGER GetProfileString IN Win32API;
STRING c_section, STRING c_entry, STRING cdefault,;
STRING @cbuffer, INTEGER nBufflen
lcbuffer = SPACE(200)
lnbuflen = LEN(lcbuffer)
lnbuflen = GetProfileString("windows", "device", "", @lcbuffer, lnbuflen)

To extract the name use:

lcname = LEFT(lcbuffer, AT(",", lcbuffer) - 1)

The only problem with the above may be under NT, where the printer name may be kept in the registry.

hth,

George
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