首页  编辑  

动态调用DLL中的函数

Tags: /超级猛料/DLL.动态链接库/   Date Created:
typedef DWORD (WINAPI Fun) (DWORD,DWORD);
 HINSTANCE hkDll=LoadLibrary("KERNEL32.DLL");
 Fun*RegisterServiceProcess=(Fun*)::GetProcAddress(hkDll,"RegisterServiceProcess");
 (*RegisterServiceProcess)(NULL,1);
 FreeLibrary(hkDll);
===============
var
 H: HWnd;
 p: procedure(Handle: THandle; Path: PChar); stdcall;
begin
       H := LoadLibrary(PChar('shdocvw.dll'));
       if H <> 0 then
         begin
           p := GetProcAddress(H, PChar('DoOrganizeFavDlg'));
           if Assigned(p) then p(Application.Handle, PChar(favpath));
         end;
     FreeLibrary(h);
end;