
03.08.2012, 13:43
|
Новичок
|
|
Регистрация: 07.06.2012
Сообщения: 59
Версия Delphi: 6, 7
Репутация: 10
|
|
Цитата:
Сообщение от colanah
и как ее переделать , что бы на выходе получались хэндлы содержащие в названии "ААА"?)
|
Примерно так:
Код:
type
THwndList = array of HWND;
procedure FindWindowByTitle(WindowTitle: string; out HwndList: THwndList);
var
NextHandle: Hwnd;
NextTitle: array[0..260] of char;
begin
HwndList:=nil;
// Get the first window
NextHandle := GetWindow(Application.Handle, GW_HWNDFIRST);
while NextHandle > 0 do
begin
// retrieve its text
GetWindowText(NextHandle, NextTitle, 255);
if Pos(WindowTitle, StrPas(NextTitle)) <> 0 then
begin
SetLength(HwndList, Length(HwndList)+1);
HwndList[High(HwndList)] := NextHandle;
end
else
// Get the next window
NextHandle := GetWindow(NextHandle, GW_HWNDNEXT);
end;
end;
|