Re: Ocx Registration Q. by Sietse
Sietse
Sun Sep 19 17:44:37 CDT 2004
In your example you're using the ctBanner OCX from the DBITech Toolkit. This
control is based on a class which is instanciated in the OLE container. This
class in this case is the CTBanner.CTBanner3 class. You can see the
classname in the OLEClass propert of the OLEContainer control.
This class is just like the Word.Application class you use with automation:
oWord = CREATEOBJECT("Word.Application")
When you instanciate the class the class is searched by VFP in a specific
order (from VFP8 help topic CREATEOBJECT):
1. Visual FoxPro base classes.
2. Classes in the current program.
3. Classes in .vcx class libraries opened with SET CLASSLIB.
4. Classes in procedure files opened with SET PROCEDURE.
5. Classes in the Visual FoxPro program execution chain.
6. The OLE registry if SET OLEOBJECT is ON.
In the case of the OLEObjects, the classes are defined in the root of the
HKEY_CLASSES_ROOT of the registry.
When the OCX is properly registered the ctBANNER.ctBannerCtrl.3 key is founc
in the HKEY_CLASSES_ROOT. This key has a sub-key named CLSID which stores a
GUID ({990069E6-CACB-11D4-A1FF-00E098856412}). This GUID points to a key in
the HKEY_CLASSES_ROOT\CLSID key:
HKEY_CLASSES_ROOT\CLSID\{990069E6-CACB-11D4-A1FF-00E098856412}
There you can find numerous sub-keys, f.i. on where the OCX-file is stored
(the InprocServer32-key)
You can make the check more or less advanced. When the
HKEY_CLASSES_ROOT\ctBanner.ctBannerCtrl.3 key exists it can be sufficient,
but you can also read the value of the
HKEY_CLASSES_ROOT\ctBanner.ctBannerCtrl.3\CLSID\(default) key value and use
tht value to retrieve where the OCX should be on the hard-drive and check if
the file still exists.
To do so you can use the _registry.vcx wrapper from the foundation classes,
or you can use the RegOpenKey, RegCloseKey, RegQueryValueEx API functions
directly.
HTH,
Sietse Wijnker
"Morningstar" <REMOVEjm@ablecon.com> wrote in message
news:414df5ad_1@127.0.0.1...
>>>OCX's in the startup of the progam by checking for availability of the
>>>class in the registry and give a message to the user if he class isn't
>>>found.
>
> How do you do this?
>
<snipped>