分    分       分   分
  分    分       分   分      分分
分分分分  分 分     分     分    分分分分
  分  分   分    分     分    分分分分
  分 分     分  分       分   分分分分
  分分 分分分分   分 分分分分分分分 分   分分
分分分  分  分       分   分     分分
  分  分  分       分   分
  分  分 分分 分    分    分     分分
  分  分    分   分     分     分分
分分分  分分分分分分 分分   分分分

解决方案 »

  1.   

    Private Declare Function CallProc Lib "user32" Alias "CallWindowProcA" (ByVal lpFunc As Long, ByVal p1 As Long, ByVal p2 As Long, ByVal p3 As Long, ByVal p4 As Long) As Long
    Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
    Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
    Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As LongFunction UnRegisterOcxOrDll(ByVal strFileName As String) As Boolean
    Dim hDLL As Long
    Dim pFunc As Long
    Dim nRet As Long
    hDLL = LoadLibrary(strFileName)
    UnRegisterOcxOrDll = True
    If hDLL <= 0 Then
        UnRegisterOcxOrDll = False
        Exit Function
    End If
    pFunc = GetProcAddress(hDLL, "DllUnregisterServer")
    If pFunc <= 0 Then
        UnRegisterOcxOrDll = False
        Exit Function
    End If
    nRet = CallProc(pFunc, 0, 0, 0, 0)
    FreeLibrary hDLL
    End Function
    Function RegisterOcxOrDll(ByVal strFileName As String) As Boolean
    Dim hDLL As Long
    Dim pFunc As Long
    Dim nRet As Long
    hDLL = LoadLibrary(strFileName)
    RegisterOcxOrDll = True
    If hDLL <= 0 Then
        RegisterOcxOrDll = False
        Exit Function
    End If
    pFunc = GetProcAddress(hDLL, "DllRegisterServer")
    If pFunc <= 0 Then
        RegisterOcxOrDll = False
        Exit Function
    End If
    nRet = CallProc(pFunc, 0, 0, 0, 0)
    FreeLibrary hDLL
    End Function'使用方法
    Private Sub Form_Load()
    Dim bOK As Boolean
    bOK = RegisterOcxOrDll("prjsyshook.dll")
    If bOK Then
        MsgBox "注册成功"
    Else
        MsgBox "注册失败"
    End IfbOK = UnRegisterOcxOrDll("prjsyshook.dll")
    If bOK Then
        MsgBox "取消注册成功"
    Else
        MsgBox "取消注册失败"
    End If
    End Sub