unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br> Dialogs,ddeman, StdCtrls,unit2;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br>function GetModuleFileNameExA(hProcess: Cardinal; hModule: Cardinal; lpFilename: pChar; nSize: LongInt): LongInt; stdcall; external 'psapi.dll' name 'GetModuleFileNameExA';<br><br>var<br> Form1: TForm1;<br><br>implementation<br><br><br>{$R *.dfm}<br><br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>fullname:array[1..1024] of char;<br>h_Wnd : HWND;<br> prID, hProcess : DWORD;<br>begin<br>GetWindowThreadProcessId(窗口句并,@prID);<br><br>hProcess:=OpenProcess(PROCESS_ALL_ACCESS,BOOL(0),prID);<br><br><br><br>GetModuleFileNameExA(hProcess,0,@fullname,1024);<br><br><br>showmessage(fullname);<br><br>CloseHandle(hProcess);<br>end;<br><br>end.