 |
\r\n\r\n\r\nHeres a sub from part of my IDE, to register (or unregister) a COM component, passing the filename: \r\n \r\n \r\n Code: \r\n Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long\r\nPrivate Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long\r\nPrivate Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long\r\nPrivate Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Any, ByVal wParam As Any, ByVal lParam As Any) As Long\r\nPrivate Const ERROR_SUCCESS = &H0\r\nPrivate Const ERROR_AHHHHHH = &HF\r\n\r\nPublic Function RegisterServer(hwnd As Long, DllServerPath As String, bRegister As Boolean) As Boolean\r\n On Error Resume Next\r\n \r\n Dim lb As Long, pa As Long\r\n \r\n lb = LoadLibrary(DllServerPath)\r\n If bRegister Then\r\n pa = GetProcAddress(lb, "DllRegisterServer")\r\n Else\r\n pa = GetProcAddress(lb, "DllUnregisterServer")\r\n End If\r\n \r\n If CallWindowProc(pa, hwnd, ByVal 0&, ByVal 0&, ByVal 0&) = ERROR_SUCCESS Then\r\n RegisterServer = True\r\n Else\r\n RegisterServer = False\r\n End If\r\n FreeLibrary lb\r\nEnd Function
\r\n \r\n \r\n\r\n | \r\n \r\n \r\n \r\n\r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n Last edited by lebb; 01-27-2003 at 07:07 AM.\r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n  \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n\r\n | \r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n';
// next/previous post info
pn[69784] = "69784,69784";
pn[0] = ",69784";
// cached usernames
pu[0] = guestphrase;
pu[8245] = "divil";
// -->

01-04-2002, 07:13 AM
|
 |
Funky Monkey
* Expert *
|
|
Join Date: Nov 2001
Location: England
Posts: 1,289
|
|
Registering ActiveX DLLs from VB
|
Heres a sub from part of my IDE, to register (or unregister) a COM component, passing the filename:
Code:
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
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 CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Any, ByVal wParam As Any, ByVal lParam As Any) As Long
Private Const ERROR_SUCCESS = &H0
Private Const ERROR_AHHHHHH = &HF
Public Function RegisterServer(hwnd As Long, DllServerPath As String, bRegister As Boolean) As Boolean
On Error Resume Next
Dim lb As Long, pa As Long
lb = LoadLibrary(DllServerPath)
If bRegister Then
pa = GetProcAddress(lb, "DllRegisterServer")
Else
pa = GetProcAddress(lb, "DllUnregisterServer")
End If
If CallWindowProc(pa, hwnd, ByVal 0&, ByVal 0&, ByVal 0&) = ERROR_SUCCESS Then
RegisterServer = True
Else
RegisterServer = False
End If
FreeLibrary lb
End Function
|
Last edited by lebb; 01-27-2003 at 07:07 AM.
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Threaded Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|