小七技术论坛,计算机安全和杀毒软件,编程交流于软件安全技术交流,给新手一个绿色安全的论坛

标题: 动态调用的几种写法 [打印本页]

作者: 天黑了去裸奔    时间: 2011-12-27 12:14
标题: 动态调用的几种写法
1 var
  TempGetWindowsDirectory : function (lpBuffer: PChar; uSize: UINT): UINT; stdcall;
begin
  TempGetWindowsDirectory := GetProcAddress(LoadLibrary('kernel32.dll'),'GetWindowsDirectoryA');
end;

2
var
  TempGetWindowsDirectory:function (lpBuffer: PChar; uSize: UINT): UINT; stdcall;
begin
@TempGetWindowsDirectory:= GetProcAddress(LoadLibrary('kernel32.dll'),'GetWindowsDirectoryA');
end;

3
var
TempHWND:HWND;  //存取DLL返回的句柄
TempGetWindowsDirectory : function (lpBuffer: PChar; uSize: UINT): UINT; stdcall;
TempWordPCSTR;
begin
TempWord := 'GetWindowsDirectoryA';
TempHWND := LoadLibrary('kernel32.dll');
TempGetWindowsDirectory := GetProcAddress(TempHWND,TempWord);
end;

4
type
  TempGetWindowsDirectory = function (lpBuffer: PChar; uSize: UINT): UINT; stdcall;

var
  TempHWND:HWND;
  TempWordPCSTR;
  MSDirectory:TempGetWindowsDirectory;
bagin
  TempWord := 'GetWindowsDirectoryA';
  TempHWND := LoadLibrary('kernel32.dll');
  MSDirectory :=GetProcAddress(TempHWND,TempWord);
end;



作者: huigezi    时间: 2011-12-27 13:00
这不是VC的吧?




欢迎光临 小七技术论坛,计算机安全和杀毒软件,编程交流于软件安全技术交流,给新手一个绿色安全的论坛 (https://xqmsyk.com/) Powered by Discuz! X3.3