Главная страница
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.027 c
1-1106898560
Jetus
2005-01-28 10:49
2005.02.13
Как получить результат выполнения командной строки


9-1100229362
BDA
2004-11-12 06:16
2005.02.13
Японские кроссворды...


3-1106045419
Виктор Д.
2005-01-18 13:50
2005.02.13
Таблицы Paradox


14-1106275434
Думкин
2005-01-21 05:43
2005.02.13
С Днем рождения! 21 января


1-1107025261
olookin
2005-01-29 22:01
2005.02.13
Снова проблема - отладчик не заходит в процедуру