//列举正在运行的程序
uses ShellApi;
{在interface下面type上面输入}
const MY_MESSAGE = WM_USER + 100;
procedure TForm1.Button1Click(Sender: TObject);
var
hCurrentWindow:HWnd;
szText:array[0..254] of char;
begin
hCurrentWindow := GetWindow(Handle, GW_HWNDFIRST);
while hCurrentWindow <> 0 do
begin
if GetWindowText(hCurrentWindow, @szText, 255)>0 then
Memo1.Lines.Add(StrPas(@szText));
hCurrentWindow:=GetWindow(hCurrentWindow, GW_HWNDNEXT);
end;
end;