注册DLL的API函数是什么?

CALM 2002-08-19 09:52:59
有没有例子呀?我不是想要那个什么regsvr32的方法,我记得好象是LoadLibrary?
但是实在是不知道怎么用,真是不好意思,有谁来帮帮忙?
...全文
90 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
CALM 2002-08-19
  • 打赏
  • 举报
回复
楼上两位给我的例子好象是调用DLL的方法啊,我需要的是注册DLL的方法
GetProcAddress不是找到DLL中函数地址的API么?
CALM 2002-08-19
  • 打赏
  • 举报
回复
as you known,"regsvr32" does not work well sometimes
vqunjian 2002-08-19
  • 打赏
  • 举报
回复
HINSTANCE hLib = LoadLibrary(pszDllName);

if (hLib < (HINSTANCE)HINSTANCE_ERROR)
{
DisplayMessage(IDS_LOADLIBFAILED, pszDllName); //unable to load DLL
iReturn = FAIL_LOAD; //unable to load DLL
}

// Find the entry point.
(FARPROC&)lpDllEntryPoint = GetProcAddress(hLib,
_T(“DllRegisterServer”));
if (lpDllEntryPoint != NULL)
(*lpDllEntryPoint)();
else
//unable to locate entry point

saucer 2002-08-19
  • 打赏
  • 举报
回复
sorry, try something like

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

Dim lb As Long, pa As Long
lb = LoadLibrary(DllServerPath) 'change DllServerPath to the Path to your DLL

pa = GetProcAddress(lb, "DllRegisterServer")

If CallWindowProc(pa, hWnd, ByVal 0&, ByVal 0&, ByVal 0&) =
ERROR_SUCCESS Then
MsgBox "Successful"
End If

FreeLibrary lb

actually, you could just call
shell "regsv32 " & PathToYourDLL
saucer 2002-08-19
  • 打赏
  • 举报
回复
HOWTO: Programmatically Register and Unregister .OCX Files
http://support.microsoft.com/default.aspx?scid=KB;EN-US;q173091&
CALM 2002-08-19
  • 打赏
  • 举报
回复
而且按照这个方法在win98下面会出错误

1,488

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧