Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change printer in win95
Message
De
04/10/1996 13:05:31
 
 
À
04/10/1996 12:46:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00009406
Message ID:
00009407
Vues:
28
>When user make choice in my form I want to change the default printer in Win95. I am sure there is an API function to do this. Any tricks !

Here's something. In my application, the user is able to choose the printer from a selection list. That's why there is some variables in this code. I'm sure you are gonna be able to handle that. :)

* Changement du driver dans WIN.INI
GETPROFSTR=REGFN("GetProfileString","CCC@CI","I")
WRPROF=REGFN("WriteProfileString","CCC","I")
JCOLDSET=REPLICATE(CHR(0),80)
JCSETTINGS=REPLICATE(CHR(0),80)
JNOLDLEN=CALLFN(GETPROFSTR,"Windows","Device","",@JCOLDSET,LEN(JCOLDSET))
JNRETLEN=CALLFN(GETPROFSTR,"Devices",IIF(tnImprimer<>3,aImprim(This.Multiplepages.Page1.nImprim.Value,4),;
'Print-2-Image'),"",@JCSETTINGS,LEN(JCSETTINGS))
IF JNRETLEN<1
=MESSAGEBOX("Cette imprimante n'est pas installée dans votre WIN.INI!",16,'Message')
=N_STPPARMS('MICHEL',1)
RETURN
ENDIF
JCNEWPRNT=IIF(tnImprimer<>3,ALLTRIM(aImprim(This.Multiplepages.Page1.nImprim.Value,4)),'Print-2-Image');
+","+LEFT(JCSETTINGS,JNRETLEN)
IF CALLFN(WRPROF,"Windows","Device",JCNEWPRNT)<1
=MESSAGEBOX("Il y a un problème d'écriture du fichier WIN.INI!",16,'Message')
=N_STPPARMS('MICHEL',1)
RETURN
ENDIF
#DEFINE HWND_BROADCAST 65535
#DEFINE WM_WININICHANGE 26
POSTMSG=REGFN("POSTMESSAGE","IICC","I")
=CALLFN(POSTMSG,HWND_BROADCAST,WM_WININICHANGE,0,"Windows")
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform