Hi...
you can use Regsvr32.exe /s ["yourfile.dll" or "yourfile.ocx"] , if you just will test by your hand type it in run
if you wanna to make it with your application you have two methods
method 1:
- Shell "Regsvr32.exe /s MyFile.dll", vbHide
care in your mind if your file path have any space you must place it within double quote """" & FilePath & """"
'================================================= ========second method:
-
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
-
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
-
Private Declare Function RegistryCOM Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
-
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
-
-
-
Public Function RegistryFile(ByVal FilePath As String) As Integer
-
Dim LibraryHandle As Long
-
Dim RegistryFunctionAddress As Long
-
LibraryHandle = LoadLibrary(FilePath)
-
If (LibraryHandle = 0) Then RegistryFile = 1: Exit Function
-
RegistryFunctionAddress = GetProcAddress(LibraryHandle, "DllRegisterServer")
-
If (RegistryFunctionAddress = 0) Then Call FreeLibrary(LibraryHandle): RegistryFile = 2: Exit Function
-
Call RegistryCOM(RegistryFunctionAddress, 0&, 0&, 0&, 0&)
-
Call FreeLibrary(LibraryHandle)
-
End Function
GOOD LUCK