Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do I know which OCXs have been installed
Message
De
19/12/1999 17:59:18
 
 
À
19/12/1999 17:15:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00305915
Message ID:
00305932
Vues:
26
>>You can look in the registry for the key HKEY_CLASSES_ROOT\ProgID to see whether or not a given control is currently installed and registered. You can look for the CLSID if you don't know the ProgID; it'll be encapulated in {}, under the key HKWY_CLASSES_ROOT\{CLSID}
>
>How can I know what the ProgID or CLSID should be before installing a control?
>
>Sorry Ed but this looks a little bit obscure to me. Can you help me out on this? I don't want to waste your time over this so if there is a place where I could get more informations on these issues you can save time by telling to me where to look for.
>
>If you feel courageous enough to guide me through this go for it.

All COM components store information about themselves in the registry, under the root key HKEY_CLASSES_ROOT. During the process of registration, entries are written for the COM components (ActiveX controls are COM components) to store information about them, at a minimum, the CLSID which uniquely identifies a given version of a control, and usually a ProgID, a human-readable name associated with the component so that you can refer to in more understandably when creating it. The CLSID data is stored under HKEY_CLASSES_ROOT\{CLSID}. and the ProgID data under HKEY_CLASSES_ROOT\ProgID. You can get the CLSID and ProgID for a control using any of several object viewers like the Component Gallery in VFP, or OLEView or VB's Object Browsers. If you've dropped a control on a form, you can look at the Control's ProgID in the Property Sheet there, too in the OleClass property

You can use the Win32 API or an ActiveX control to check if a registry key exists. If you have VFP6, there is a registry class in the FFC; earlier versions of VFP will need to download one of the registry classes from the FIles Section. The Windows Scripting Host's Wscript.Shell also has methods for handling the registry.

Using the FFC registry class, here's how I'd check to see if Eds.SillyControl was registered on the system:
* this assumes you have the REGISTRY.VCX, .VCT and .H from the FFC directory of VFP6
*
#INCLUDE REGISTRY.H
LOCAL oReg
oReg = NEWOBJECT('Registry','Registry.VCX')
IF oReg.IsKey('Eds.SillyControl',HKEY_CLASSES_ROOT)
   *  It's there, so it's registered
ELSE
   *  it isn't registered
ENDIF
oReg = NULL
Can't get too much easier than that!
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform