works:programmer:delphi:enum-windows
Найти все окна в EnumWindows и обработать в форме
function EnumWindowsProc(hWnd: HWND; lParam: LPARAM): BOOL; stdcall; var oForm: TForm1; sFormName: array[0..255] of AnsiChar; sFormClass: array[0..255] of AnsiChar; begin oForm := TForm1(Pointer(lParam)); GetClassName(hWnd, sFormClass, 256); GetWindowText(hWnd, sFormName, 256); if ( (StrComp(sFormClass, 'GxWindowClassD3d') = 0) and (StrComp(sFormName, 'World of Warcraft') = 0) ) then begin oForm.PushActiveClient(hWnd); end; Result := BOOL(True); end; procedure TForm1.Button1Click(Sender: TObject); begin EnumWindows(@EnumWindowsProc, LPARAM(Pointer(Self))); end; procedure TForm1.PushActiveClient(hWnd: HWND); begin MessageBox(0, 'Found', '', 0); end;
works/programmer/delphi/enum-windows.txt · Последнее изменение: 2022/09/30 23:53 — 127.0.0.1