您的位置:首页 > 编程语言 > Delphi

Delphi程序API申明调用及参数传址与传值

2013-06-17 21:29 399 查看
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
btn1: TButton;
procedure apitest(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation
function MB(hWnd: Integer; lpText, lpCaption: string; uType: Integer): Integer;
stdcall; external 'user32.dll' name 'MessageBoxA';

function FW(ClassName, WindowName: string ): Integer;
stdcall; external 'user32.dll' name 'FindWindowA';

function getthpid(jubing:Integer;var lpid: Integer ): Integer;
stdcall; external 'user32.dll' name 'GetWindowThreadProcessId';
{$R *.dfm}

procedure TForm1.apitest(Sender: TObject);
var i,pid:Integer;
begin
MB(0,'HellO WorlD','Shellcode的博客',0);
i:=FW('扫雷','扫雷');
getthpid(i,pid);
ShowMessage(IntToStr(pid));
GetWindowThreadProcessId(i,@pid);
ShowMessage(IntToStr(pid));
end;

end.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: