![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Видимые окна [D7, WinXP]
DagOT-R © (2007-07-04 05:20:00)Помогите, кто может, как узнать какие окна действительно видимы, т.е. те, которые отображаются только на TASK BAR(задолбался отсеивать всякие там типа " Program manager", а также окна типа "Закрыть" и "Свернуть" (Когда наводишь на кнопку Minimize [_]и System menu [X])! Заранее спасибо.
DVM (2007-07-04 16:15:00) [1]
function IsAppWindow(Wnd: HWND): BOOL;
var
Style, ExtStyle: LongInt;
hOwner, hParent: HWND;
begin
Result := true;
if not IsWindow(Wnd) then
begin
Result := false;
exit;
end;
Style := GetWindowLong(Wnd, GWL_STYLE);
ExtStyle := GetWindowLong(Wnd , GWL_EXSTYLE);
hOwner := GetWindow(Wnd, GW_OWNER);
hParent := GetParent(Wnd);
if (Style and WS_CHILD) <> 0 then result := false;
if (Style and WS_VISIBLE) = 0 then Result := false;
if not IsWindowVisible(Wnd) then Result := false;
if (ExtStyle and WS_EX_TOOLWINDOW) <> 0 then Result := false;
if (ExtStyle and WS_EX_MDICHILD) <> 0 then Result := false;
if (hOwner <> 0) and ((ExtStyle and WS_EX_APPWINDOW) = 0) then result := false;
if (hOwner <> 0) and Result then Result := not IsAppWindow(hOwner);
if hParent <> 0 then Result := false;
if GetWindowLong(Wnd , GWL_USERDATA) = MagicDWord then Result := false;
end; // End of function IsAppWindow;
Dib@zol (2007-07-04 13:47:00) [2]Ах да. Также, против нахождения всякого рода контролов помогает GetWindowLong. Получаешь информацию о стилевых флагах, разбиваешь побитно и если биты 23 и 24 включены (те. присутствует флаг WS_CAPTION = $C00000 = WS_BORDER+WS_DLGFRAME) то это окно.
Dib@zol (2007-07-04 13:42:00) [3]Попробуй после того как нашёл все окна, последовательно потестить их ф-цией IsWindowVisible. Теоретически, помогает...