function EnumWindowsProc(hwnd:HWND;lParam:DWORD ):boolean; stdcall;
var
szCaption: array[0..256] of Char;
begin
GetWindowText(hwnd,szCaption,127); if length(szCaption)>0 then
begin
showmessage(szCaption);
end; result:= TRUE;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
EnumWindows(@EnumWindowsProc, 0);
end;
var
szCaption: array[0..256] of Char;
begin
GetWindowText(hwnd,szCaption,127); if length(szCaption)>0 then
begin
showmessage(szCaption);
end; result:= TRUE;
end;procedure TForm1.Button1Click(Sender: TObject);
begin
EnumWindows(@EnumWindowsProc, 0);
end;
我按照你的写法编写程序,但是运行是Delphi说
EnumWindows(@EnumWindowsProc,0)这句出现Variable required的错误。