|
-
May 5th, 2001, 07:41 PM
#1
Thread Starter
Frenzied Member
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)
-
May 5th, 2001, 07:42 PM
#2
PowerPoster
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
-
May 5th, 2001, 07:53 PM
#3
Thread Starter
Frenzied Member
is there any other way to do it without using api?
-
May 5th, 2001, 08:09 PM
#4
Frenzied Member
Why not just register it when you install your program?
It seems that would be alot easier.
-
May 5th, 2001, 08:35 PM
#5
Thread Starter
Frenzied Member
the installer i use wont do that..
-
May 5th, 2001, 08:42 PM
#6
Frenzied Member
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.
-
May 5th, 2001, 09:01 PM
#7
Thread Starter
Frenzied Member
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)
-
May 5th, 2001, 09:23 PM
#8
Frenzied Member
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.
-
May 5th, 2001, 09:26 PM
#9
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|