'远程DLL卸载
'DLLaddr 模块句柄（就是DLL的首地址）
'如果DLL还在使用中，软件就会崩溃
Function RemoteDLLkill(ByVal jID as UInteger, ByVal DLLaddr as HINSTANCE) as Long '远程DLL卸载
   Dim hProcess as HANDLE
   Dim pfnStartAddr as HANDLE, DohThread as HANDLE, lResult as DWord
   Dim lp as SECURITY_ATTRIBUTES
   hProcess = OpenProcess(&H1F0FFF, False, jID)
   If hProcess > 0 Then
      
      pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "FreeLibrary") '获取加载DLL函数入口
      DohThread = CreateRemoteThread(hProcess, @lp, Null, pfnStartAddr, Cast(LPVOID, DLLaddr), 0, 0) '运行远程线程
'      Print Hex(jid), Hex(DLLaddr), DohThread
      If DohThread <> 0 Then
'         WaitForSingleObject DohThread, 5000
         CloseHandle DohThread '关闭
      End If
      CloseHandle hProcess '关闭
   End If
   Function = DohThread <> 0
End Function