Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Eric den Doop
  Where is Eric den Doop?
 Houten
 Netherlands
 Eric den Doop
 To: Boudewijn Lutgerink
  Where is Boudewijn Lutgerink?
 Hoonaardstraat, Driel
 Netherlands
 Boudewijn Lutgerink
 Tags
Subject: RE: do I need to register OCX???
Thread ID: 22045 Message ID: 22064 # Views: 21 # Ratings: 0
Version: Visual FoxPro 8 Category: Active X Controls & OLE Automation
Date: Tuesday, April 08, 2003 11:00:40 AM         
   


> 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

COMPLETE THREAD

do I need to register OCX??? Posted by Boudewijn Lutgerink @ 4/8/2003 7:52:12 AM
RE: do I need to register OCX??? Posted by Eric den Doop @ 4/8/2003 9:29:01 AM
RE: do I need to register OCX??? Posted by Caij Gomez @ 4/8/2003 9:37:05 AM
RE: do I need to register OCX??? Posted by Boudewijn Lutgerink @ 4/8/2003 10:12:26 AM
RE: do I need to register OCX??? Posted by Boudewijn Lutgerink @ 4/8/2003 9:38:10 AM
RE: do I need to register OCX??? Posted by Boudewijn Lutgerink @ 4/8/2003 10:36:04 AM
RE: do I need to register OCX??? Posted by Eric den Doop @ 4/8/2003 11:00:40 AM
RE: do I need to register OCX??? Posted by Boudewijn Lutgerink @ 4/8/2003 11:41:41 AM