Results 1 to 9 of 9

Thread: Register a dll/ocx on rumtime - only once, not again

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195

    Register a dll/ocx on rumtime - only once, not again

    How can u register a dll/ocx (using regsvr32) on runtime the first time a program is loaded, and then not again? (as in, if its already registered, dont register it again)

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    I forget where I got this, but it may work
    Code:
    Declare Function RegComCtl32 Lib "ComCtl32.OCX" _
    Alias "DllRegisterServer" () As Long
    Declare Function UnRegComCtl32 Lib "ComCtl32.OCX" _
    Alias "DllUnregisterServer" () As Long
    Const ERROR_SUCCESS = &H0
    
    If RegComCtl32 = ERROR_SUCCESS Then
        MsgBox "Registration Successful"
    Else
        MsgBox "Registration Unsuccessful"
    End If
    
    If UnRegComCtl32 = ERROR_SUCCESS Then
        MsgBox "UnRegistration Successful"
    Else
        MsgBox "UnRegistration Unsuccessful"
    End If

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    is there any other way to do it without using api?

  4. #4
    Frenzied Member
    Join Date
    Mar 2001
    Location
    You are HERE •™
    Posts
    1,300
    Why not just register it when you install your program?
    It seems that would be alot easier.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    the installer i use wont do that..

  6. #6
    Frenzied Member
    Join Date
    Mar 2001
    Location
    You are HERE •™
    Posts
    1,300
    Oh...weren't you asking about installers earlier. Inno Setup will do that. Give it a try it's really not that hard especially if you use one of the 3rd party programs that you can use with it. Just keep testing the install out on your system until you get the installation just right. If you want some help with Inno Setup just ask. Alot of people here could help you out.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    hehe thats the exact program i use - i dont use any 3rd party tools, just inno, but it doesnt offer to register dlls or ocxs. I gave it to one of my friends to test, but it doesnt work (as in, it doesnt register the dll)

  8. #8
    Frenzied Member
    Join Date
    Mar 2001
    Location
    You are HERE •™
    Posts
    1,300
    Well let's see either you don't have it setup to register...Here's a sample line from one of my Inno Scripts that will register the file MSVBVM60.dll when the computer restarts. AlwaysRestart=true prompts the user to restart computer.

    [Setup]
    AlwaysRestart=true

    [Files]
    Source: D:\ServicePack5\vb6sp5sys\MSVBVM60.dll; DestDir: {sys}; Flags: restartreplace uninsneveruninstall regserver; CopyMode: alwaysskipifsameorolder


    Or maybe the file is already on your friends computer, and it isn't being installed.

    You should look into IS Tool for Inno-Setup. All you do is go through a bunch of menus making your choices for how to install, and then it spits the Inno script out for you, and it can also compile the script using Inno's compiler. Too Easy. Plus it's Free.

  9. #9
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    RegSvr32.exe is the program used to register dll's and Ocx's. You can find this file in your Systems Folder. You can use the code
    Code:
    Shell RegSvr32.exe <your app name with path>
    This will register your dll and OCX. Once you have registered, have a value stored in registry. Every time before calling the registry finction, check for the value.

    You can also use the ShellExecute api function instead of shell. It has options for passing arguments to the command line.

    BTW, you can also use GPInstall as your installer. Its also free as InnoSetup but does register the dll's and OCX's

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