函数常规动态调用

2016-08-22 10:22:36来源:http://zxw713.blog.51cto.com/691598/815591作者:Redhat293人点击


implementation


{$R *.dfm}
{
======================================================================


例子函数:
function GetWinDir: string; //C:/WINDOWS
var
dir: array [0..MAX_PATH] of Char;
begin
GetWindowsDirectory(dir, MAX_PATH); //假设特征码为:GetWindowsDirectory
Result := StrPas(dir);
end;


快捷键: CTRL + 鼠标左键 代码的转跳


========================================================================
}
function GetWinDir: string; //C:/WINDOWS
var
dir: array [0..MAX_PATH] of Char;


TempGetWindowsDirectory : function (lpBuffer: PChar; uSize: UINT): UINT; stdcall;
begin
TempGetWindowsDirectory := GetProcAddress(LoadLibrary('kernel32'),'GetWindowsDirectoryA');
TempGetWindowsDirectory(dir, MAX_PATH); //假设特征码为:GetWindowsDirectory
Result := StrPas(dir);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(GetWinDir);
end;


end.


最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台