- Option Explicit
-
- ' #####################################################################################
- ' # Reg auto d'un ActiveX
- ' # Peut être utile pour un plug in
- ' #####################################################################################
-
- 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
-
- Public Function RegisterServer(ByVal Prm_L_hWnd As Long, ByVal Prm_S_DllServerPath As String, byval Prm_B_Register As Boolean) as boolean
-
- On Error Goto RegisterServer_Err
-
- Dim L_Lib As Long
- Dim L_ProcAdress As Long
-
- L_Lib = LoadLibrary(Prm_S_DllServerPath)
-
- If Prm_B_Register Then
- L_ProcAdress = GetProcAddress(L_Lib, "DllRegisterServer")
- Else
- L_ProcAdress = GetProcAddress(L_Lib, "DllUnregisterServer")
- End If
-
- If CallWindowProc(L_ProcAdress, Prm_L_hWnd, ByVal 0&, ByVal 0&, ByVal 0&) = ERROR_SUCCESS Then
- RegisterServer = True
- Else
- RegisterServer = False
- End If
-
- Call FreeLibrary(L_Lib)
-
- Exit Function
-
- RegisterServer_Err:
-
- Call MsgBox("Erreur numéro : " & Err.Number & vbCrLf & "Description : " & Err.Description)
-
- End Function
Option Explicit
' #####################################################################################
' # Reg auto d'un ActiveX
' # Peut être utile pour un plug in
' #####################################################################################
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
Public Function RegisterServer(ByVal Prm_L_hWnd As Long, ByVal Prm_S_DllServerPath As String, byval Prm_B_Register As Boolean) as boolean
On Error Goto RegisterServer_Err
Dim L_Lib As Long
Dim L_ProcAdress As Long
L_Lib = LoadLibrary(Prm_S_DllServerPath)
If Prm_B_Register Then
L_ProcAdress = GetProcAddress(L_Lib, "DllRegisterServer")
Else
L_ProcAdress = GetProcAddress(L_Lib, "DllUnregisterServer")
End If
If CallWindowProc(L_ProcAdress, Prm_L_hWnd, ByVal 0&, ByVal 0&, ByVal 0&) = ERROR_SUCCESS Then
RegisterServer = True
Else
RegisterServer = False
End If
Call FreeLibrary(L_Lib)
Exit Function
RegisterServer_Err:
Call MsgBox("Erreur numéro : " & Err.Number & vbCrLf & "Description : " & Err.Description)
End Function