> > Sorry Eric but I HAVE TO disappoint you.
> > I just tested it with an OCX I had on the laptop and not on the corporate machine.
> > I simply copied the ocx to a testdirectory never registered it and simply used it.
> > All I had to do was place it in the list of controls through tools|options|controls->ActiveX.
>
> And that's exactly when the OCX gets registered in the registry! VFP runs the DllRegisterServer command on the background. Try it again. Here's an easy test to prove my theory. Unregister MSCOMCTL.OCX (regsvr32 -u MSCOMCTL.OCX) and run this code. Then use the Options dialog to select MSCOMCTL.OCX and run this code again. Believe me: you cannot use any OCX or COM DLL without having it registered properly.
>
>
> ?GetLibraryFile("MSComctlLib.TreeCtrl.2") && Treeview control of the WindowsCommon Controls 6.0 library
>
> FUNCTION GetLibraryFile
> LPARAMETER tcOleClass
> LOCAL lnRetval, lnHandle, lcBuffer, lcSubKey, lcRetval
> #DEFINE HKEY_CLASSES_ROOT 0x80000000
> #DEFINE SECURITY_ACCESS_MASK 983103
> #DEFINE REG_SZ 1
> DECLARE INTEGER RegOpenKeyEx IN Win32API ;
> INTEGER nKey, STRING @cSubKey, INTEGER nReserved,;
> INTEGER nAccessMask, INTEGER @nResult
> DECLARE INTEGER RegQueryValueEx IN Win32API ;
> INTEGER nKey, STRING cValueName, INTEGER nReserved,;
> INTEGER @nType, STRING @cBuffer, INTEGER @nBufferSize
> DECLARE INTEGER RegCloseKey IN Win32API ;
> INTEGER nKey
> lnRetval = 0
> lnHandle = 0
> lcBuffer = SPACE(255) + CHR(0)
> lcSubKey = tcOleClass + "\Clsid"
> RegOpenKeyEx(HKEY_CLASSES_ROOT, @lcSubKey, 0, SECURITY_ACCESS_MASK,@lnHandle)
> RegQueryValueEx(lnHandle, "", 0, REG_SZ, @lcBuffer, LEN(lcBuffer))
> RegCloseKey(lnHandle)
> * retrieve the ClsID value of the class from the Registry
> lcRetval = ALLTRIM(STRTRAN(LEFT(lcBuffer, AT(CHR(0), lcBuffer)), CHR(0),""))
> IF NOT EMPTY(lcRetval)
> lnHandle = 0
> lcBuffer = SPACE(255) + CHR(0)
> lcSubKey = "CLSID\" + lcRetval + "\InprocServer32"
> RegOpenKeyEx(HKEY_CLASSES_ROOT, @lcSubKey, 0, SECURITY_ACCESS_MASK,@lnHandle)
> RegQueryValueEx(lnHandle, "", 0, 0, @lcBuffer, LEN(lcBuffer))
> RegCloseKey(lnHandle)
> * retrieve class lib file name
> lcRetval = ALLTRIM(STRTRAN(LEFT(lcBuffer, AT(CHR(0), lcBuffer)), CHR(0),""))
> ELSE
> lcRetval = "error: class not found in registry"
> ENDIF
> RETURN lcRetval
> ENDFUNC
>
> --
> Eric den Doop
>
www.foxite.com - The Home Of The Visual FoxPro Experts
Sh*t, you're right. This function returned very neatly all I was looking for in the registry.
Boudewijn Lutge®ink
Boudewijn.Lutgerink@foxite.comExperience is the knowledge you get immediately AFTER you actually needed it...