in early versions of Win95.
I could use regsvr32 i guess? or maybe regsvr? Is this right? They dont come with the install, and i thought maybe there was another way?
BW :cool:
Printable View
in early versions of Win95.
I could use regsvr32 i guess? or maybe regsvr? Is this right? They dont come with the install, and i thought maybe there was another way?
BW :cool:
Windows/Start/Run/regsvr32.exe "C:\Windows\System\Resize.dll"
Use RegSvr32.exe. You can distribute it with your apps and install it on the system if it doesn't exist.
Here's a way to do it in code, so if you need to register a DLL on the fly, you can:
I'm not sure where this code came from (it's in my source DB), so I apologise in advance for not providing due credit. :DCode:Public Enum RegUnreg
Register = 0
UnRegister = 1
End Enum
Public Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" _
(ByVal lpLibFileName As String) As Long
Public Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, _
ByVal lpProcName As String) As Long
Public Declare Function CreateThread Lib "kernel32" (lpThreadAttributes As Any, _
ByVal dwStackSize As Long, ByVal lpStartAddress As Long, ByVal lParameter As Long, _
ByVal dwCreationFlags As Long, lpThreadID As Long) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal hHandle As Long, _
ByVal dwMilliseconds As Long) As Long
Public Declare Function GetExitCodeThread Lib "kernel32" (ByVal hThread As Long, _
lpExitCode As Long) As Long
Public Declare Sub ExitThread Lib "kernel32" (ByVal dwExitCode As Long)
Public Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Function RegisterDLLOROCX(File As String, _
Optional Process As RegUnreg = Register, _
Optional PromptOnError As Boolean = False) As Boolean
Dim LoadedLib As Long
Dim EntryPoint As Long
Dim ExitCode As Long
Dim newThread As Long
Dim newThreadID As Long
On Error Resume Next
'// Check file exists
If Dir(File, vbNormal) = "" Then
If PromptOnError Then MsgBox "The file " & File & " doesn't exist", vbCritical, "DLL/OCX Register"
RegisterDLLOROCX = False
Exit Function
End If
LoadedLib = LoadLibrary(File) '// Load file
If LoadedLib = 0 Then
If PromptOnError Then MsgBox "An error occured while loading the file " & File, vbCritical, "DLL/OCX Register"
RegisterDLLOROCX = False
Exit Function
End If
'// Find right entery point
If Process = Register Then
EntryPoint = GetProcAddress(LoadedLib, "DllRegisterServer")
ElseIf Process = UnRegister Then
EntryPoint = GetProcAddress(LoadedLib, "DllUnregisterServer")
Else
If PromptOnError Then MsgBox "An error occured while loading the file " & File, vbCritical, "DLL/OCX Register"
RegisterDLLOROCX = False
Exit Function
End If
If EntryPoint = vbNull Then
If PromptOnError Then MsgBox "An error occured while locating the entery point for the file : " & vbNewLine & File, vbCritical, "DLL/OCX Register"
FreeLibrary (LoadedLib) '// Unload libarary
RegisterDLLOROCX = False
Exit Function
End If
Screen.Mousepointer = vbHourglass
newThread = CreateThread(ByVal 0, 0, ByVal EntryPoint, ByVal 0, 0, newThreadID) '// Create a new thread.
If newThread = 0 Then
Screen.Mousepointer = vbDefault
If PromptOnError Then
MsgBox "An error occured while attempting to create a new thread.", vbCritical, "DLL/OCX Register"
End If
FreeLibrary (LoadedLib) '// Unload libarary
Exit Function
End If
If WaitForSingleObject(newThread, 10000) <> 0 Then
Screen.Mousepointer = vbDefault
If PromptOnError Then MsgBox "An error occured while attempting to register/unregister the file : " & vbNewLine & File, vbCritical, "DLL/OCX Register"
ExitCode = GetExitCodeThread(newThread, ExitCode)
ExitThread (ExitCode)
FreeLibrary (LoadedLib)
RegisterDLLOROCX = False
Exit Function
End If
CloseHandle (newThread) '// Close thread
FreeLibrary (LoadedLib) '// Unload libarary
Screen.Mousepointer = vbDefault '// Reset cursor
RegisterDLLOROCX = True
End Function
- gaffa