function EnumWindowsProc(hwnd: HWND; lparam: LPARAM): Boolean; stdcall; var buf: array[Byte] of Char; begin Result:= True; GetWindowText(hwnd, buf, SizeOf(buf)); Form1.Memo1.Lines.Add(buf); Form1.Memo1.Lines.Add(IntToStr(hwnd)); end; procedure TForm1.Button1Click(Sender: TObject); begin EnumWindows(@enumwindowsproc,0); EnumChildWindows(HWND,@enumwindowsproc,0); //遍历子窗口多了一个参数.父窗口 end;
delphi 遍历窗口
时间: 2024-10-01 03:36:58