A common use of this function is to load a dynamic-link library (DLL), perform a subsequent call to GetProcAddress() to get the address of an exported DLL routine, and call this DLL routine through the address that is returned. Another use of LoadLibrary() is to load an executable module and retrieve its resources. #include <windows.h> #include <mshtmhst.h>{ HINSTANCE hinstMSHTML = LoadLibrary(TEXT("MSHTML.DLL"));if(hinstMSHTML) { SHOWHTMLDIALOGFN *pfnShowHTMLDialog;
pfnShowHTMLDialog = (SHOWHTMLDIALOGFN*)GetProcAddress(hinstMSHTML, TEXT("ShowHTMLDialog")); if(pfnShowHTMLDialog) { /* Perform initialization and then call ShowHTMLDialog. */ }
服了csdn,说我回复太快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 Sub Form_Load() MsgBox Hex(GetProcAddress(LoadLibrary("kernel32.dll"), "GetTickCount")) End Sub得到了1个long,剩下的不会了
#include <mshtmhst.h>{
HINSTANCE hinstMSHTML = LoadLibrary(TEXT("MSHTML.DLL"));if(hinstMSHTML)
{
SHOWHTMLDIALOGFN *pfnShowHTMLDialog;
pfnShowHTMLDialog = (SHOWHTMLDIALOGFN*)GetProcAddress(hinstMSHTML, TEXT("ShowHTMLDialog")); if(pfnShowHTMLDialog)
{
/*
Perform initialization and then call ShowHTMLDialog.
*/
}
FreeLibrary(hinstMSHTML);
}
}
GetProcAddress(查出的句柄,Functionname)
得到这个又可以干什么呢,谢谢,是不是可以修改dll资源呢?如果可以应该怎样做呢,谢谢啦
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private Sub Form_Load()
MsgBox Hex(GetProcAddress(LoadLibrary("kernel32.dll"), "GetTickCount"))
End Sub得到了1个long,剩下的不会了