Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Win API to cofigure Application to use with an extensio
Message
 
À
22/12/2000 19:15:33
Peter Wagner
Point Informática Ltda.
Limeira, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00456533
Message ID:
00456674
Vues:
24
>How can I using VFP and Win API
>define what application should be used
>to open a file ?
>
>Supose I have Text Editors like Wordpad, Word
>and StarOffice Word in a Network and each user
>want to use a distinct product to open a file with
>an .RTF extension created by VFP (RichText control)
>and saved as a new file with the .RTF extension.
>
>With which API I can define the application to open
>the file ?
>
>I want to use Wscript in VFP to open a .RTF file
>this way:
>
>ox = CREATEOBJECT("WScript.Shell")
>ox.Run("C:\Mydir\text1.RTF", SW_NORMAL, .F.)
>
>But, what I see is that the application must
>configure the user preferences for a Text Editor
>so I want to set up those preferences in the station,
>when startig and VFP Application.
>
>Could someone help me please ?
>
>Other question: Is it possible to configure WordPad Menu
>option's from VFP, Wscript or any other way ??
>
>Thank's in Advance and Merry Xmas for All !!

Peter,

This information is stored in the registry. It's a couple of step process. First retrieve the default value associated with the extension in the HKEY_CLASSES_ROOT hive. This is the ProgId. You'd then change the value found in HKEY_CLASSES_ROOT\< ProgID >\Shell\Open\Command.

For example, for a bitmap

HKEY_CLASSES_ROOT\.bmp

as the default value Paint.Picture

the key

HKEY_CLASSES_ROOT\Paint.Picture\Shell\Open\Command

contains

""C:\PROGRA~1\ACCESS~1\MSPAINT.EXE" "%1""

Changing the above value will change the program associated with it.

You could easily use the registry class that comes in the FFC to do this.
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