Results 1 to 3 of 3

Thread: Registering ActiveX Controls

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    6

    Question

    I am currently creating my first ActiveX controls and am using Project Compatibility.

    When I look to add one of my activeX components to a new project there appear to be three components named the same thing (each probably with the OCX in a diff directory (however I can't see the full path as VB is a bit pants). therefore I am browsing to make sure I get the right OCX.

    I guess these all appear because the ocx's have been registered at some point. Is there anyway in which a i can see what controls are registered and where - rather than using the vb interface and b how do I unregister the unwanted controls

    (I have tried to use regsvr32 to unregister the component but iot only unregisters the one I want!! not the others)

    A pointer to a good overview of how controls are registered and versions etc would be great cheers

    Jon

  2. #2
    Junior Member
    Join Date
    Aug 2000
    Posts
    17
    Welcome to ActiveX hell...more commonly known as DLL hell, if you were using DLL's

    Compatibility issues are a MAJOR problem with ActiveX components, as you've learned...especially when you're just starting out -- it's freakin bewildering. It's even a problem for seasoned veterans, at times because it's not without it's bugs either.

    The reason you have so many references is probably because you have compiled some previous versions of your control, then deleted them (or moved them) without unregistering them first. In the future you can do several things:

    1) make sure if you compile new components (and this applies to all COM components including DLL's, OCX's and EXE's), that you unregister them before you delete them. (If you haven't deleted the other ones yet, use REGSVR32 /u and specify the path to those other components you want to unregister. OR if they are still in your recycle bin, restore them, THEN unregister them...that has worked for me in the past)

    2) Compile them to the same directory. This should always overwrite the existing component. The reason you see multiple instances of your component in the References list is that the registry has recorded too many unique GUID's for the component in question. If you compile to different directories all the time, new registry entries will be created with new GUID's = one big mess

    3) Use project compatability while you are still in the development stage, but be SURE to set Binary compatability when the interfaces in your component won't change any further

    4) try using NO compatability then compile again... it *might* clear out the garbage references in your registry

    5) manually comb through the registry and remove any references to your component (do a search on the name of your component, or even better, for the name of a CLASS within your component)

    6) try the registry cleaner from MS...I haven't tried this but it just occurred to me this might work for cleaning out the garbage entries. Search for it on their website

    Read more about component versioning at:
    http://msdn.microsoft.com/library/de...patibility.htm

  3. #3
    New Member
    Join Date
    Jan 2001
    Location
    Near Cardiff, Wales, UK
    Posts
    7

    Cool

    I tend to use regclean at least 10 times per day when I'm developing and testing components !

    Here's an interesting article for you to read, there's also a link to regclean.exe so that you can download it if you wish.

    http://msdn.microsoft.com/library/pe...leanWinReg.htm

    Also, if you copy the text below into a text file and save it with an extension of .reg and then run it (after first taking a backup of your registry - just in case...), you will be able to register and un-register DLLs, OCXs etc by right clicking them and making the appropriate selection from the popup menu.

    REGEDIT4

    [HKEY_CLASSES_ROOT\dllfile\Shell]

    [HKEY_CLASSES_ROOT\dllfile\Shell\Register]

    [HKEY_CLASSES_ROOT\dllfile\Shell\Register\command]
    @="d:\\winnt\\system32\\RegSvr32 \"%1\""

    [HKEY_CLASSES_ROOT\dllfile\Shell\Unregister]

    [HKEY_CLASSES_ROOT\dllfile\Shell\Unregister\command]
    @="d:\\winnt\\system32\\RegSvr32 /u \"%1\""

    [HKEY_CLASSES_ROOT\.ocx]
    @="ocxfile"
    "Content Type"="Active X control"

    [HKEY_CLASSES_ROOT\ocxfile\Shell]

    [HKEY_CLASSES_ROOT\ocxfile\Shell\Register]

    [HKEY_CLASSES_ROOT\ocxfile\Shell\Register\command]
    @="d:\\winnt\\system32\\RegSvr32 \"%1\""

    [HKEY_CLASSES_ROOT\ocxfile\Shell\Unregister\command]
    @="c:\\winnt\\system32\\RegSvr32 /u \"%1\""


    The text above is for Windows NT4 (and probably 2000 although I haven't tried it). To alter it for 95 or 98, all I've ever done is change any references to "winnt" to "windows" and that seems to do the job.

    Hope that helps.
    The badder the better !
    Rob T

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width