Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.02.13;
Скачать: CL | DM;

Вниз

список задач   Найти похожие ветки 

 
AGAMEMNUM   (2004-12-26 01:37) [0]

как его получить, что считается задачей? процессы имеющие окно? можно получить их список не ища окна для каждого процесса?


 
Игорь Шевченко ©   (2004-12-26 02:01) [1]

Задачей считается приложение, имеющее окно, ассоциированное с кнопкой на Taskbar.

Это окно должно быть видимым и не иметь WS_EX_TOOLWINDOW в ExStyle и не иметь владельца (GetWindow(WindowHandle, GW_OWNER) = 0);


> можно получить их список не ища окна для каждого процесса?


Можно перебором всех окон верхнего уровня (EnumWindows), проверяя окно на перечисленные условия.

С уважением,


 
AGAMEMNUM   (2004-12-26 02:19) [2]

Большое спасибо!


 
Leonid Troyanovsky ©   (2004-12-26 14:27) [3]


> Игорь Шевченко ©   (26.12.04 02:01) [1]

> Это окно должно быть видимым и не иметь WS_EX_TOOLWINDOW
> в ExStyle и не иметь владельца (GetWindow(WindowHandle,
> GW_OWNER) = 0);


Снова цитируем:

The test were described by Jeffrey Richter in
the Nov "97 issue of MSJ. Quoting:

"The rules the taskbar uses to decide whether a button should be shown
for a window are really quite simple, but are not well documented.
When you create a window, the taskbar examines the window"s extended
style to see if either the WS_EX_APPWINDOW (defined as 0x00040000) or
WS_EX_TOOLWINDOW (defined as 0x00000080) style is turned on. If
WS_EX_APPWINDOW is turned on, the taskbar shows a button for the
window, and if WS_EX_ TOOLWINDOW is turned on, the taskbar does not
show a button for the window. You should never create a window that
has both of these extended styles.

You can create a window that doesn"t have either of these styles. If a
window has neither style, the taskbar decides to create a button if
the window is unowned and does not create a button if the window is
owned.

One final note: before making any of the above tests, the taskbar
first checks to see if a window has the standard WS_VISIBLE window
style turned on. If this style bit is off, the window is hidden; the
taskbar never shows a button for a hidden window. Only if the
WS_VISIBLE style bit is on will the taskbar check the WS_EX_APPWINDOW,
WS_ EX_TOOLWINDOW, and window ownership information."

Ну, и прошу включить в местный фак:


function IsTaskbarBtnExist(h: HWND): Boolean;
var
exstyle: Longint;
begin
Result:= IsWindowVisible(h);
if Result then
  begin
    exstyle := GetWindowLong(h, GWL_EXSTYLE);
    Result := exstyle and WS_EX_APPWINDOW <> 0;
    if not Result and
       (exstyle and WS_EX_TOOLWINDOW = 0) then
      Result := GetWindowLong(h, GWL_HWNDPARENT) = 0;
   end;
end
;

Если, конечно, оная функция будет сочтена правдоподобной.

--
С уважением, LVT.


 
Игорь Шевченко ©   (2004-12-26 19:23) [4]

Leonid Troyanovsky ©   (26.12.04 14:27) [3]

Спасибо за дополнение насчет WS_EX_APPWINDOW, единственное, я бы заменил

>  Result := GetWindowLong(h, GWL_HWNDPARENT) = 0;


на

 Result := GetWindow (h, GW_OWNER) = 0;

согласно


> the taskbar decides to create a button if
> the window is unowned


С уважением,


 
Leonid Troyanovsky ©   (2004-12-26 19:55) [5]


> Игорь Шевченко ©   (26.12.04 19:23) [4]

> я бы заменил

> >  Result := GetWindowLong(h, GWL_HWNDPARENT) = 0;

> на

>  Result := GetWindow (h, GW_OWNER) = 0;


Спасибо.
Я в упор не рассмотрел :)

--
С уважением, LVT.


 
DVM ©   (2004-12-27 10:48) [6]

А я так делаю. Только что моя что функции выше путаются с окнами эксель. Если открывать/закрывать/создавать книги.

function IsAppWindow(Wnd: HWND): BOOL; stdcall;
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;



Страницы: 1 вся ветка

Текущий архив: 2005.02.13;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.059 c
1-1107163743
denis24
2005-01-31 12:29
2005.02.13
Проверка поля стрингрида


6-1101679609
dms_main
2004-11-29 01:06
2005.02.13
Delphi&amp;IE


1-1106837691
novice_man
2005-01-27 17:54
2005.02.13
Динамическая библиотека и указатель.


14-1106509925
Чеширский_Кот
2005-01-23 22:52
2005.02.13
Является ли склонность к чему-либо признаком деградации?


1-1106891691
Tornado
2005-01-28 08:54
2005.02.13
Перебор пунктов меню