Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2005.02.13;
Скачать: [xml.tar.bz2];

Вниз

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

 
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 вся ветка

Форум: "WinAPI";
Текущий архив: 2005.02.13;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.075 c
3-1105607678
pietro
2005-01-13 12:14
2005.02.13
Как перегнать таблицу в новый формат


1-1107242319
Боян Георгиев
2005-02-01 10:18
2005.02.13
Алгоритм для создание порядок приоритетов


8-1098891463
Colonel
2004-10-27 19:37
2005.02.13
Как програмно увеличить/уменьшить звук ?


9-1097333342
rts111
2004-10-09 18:49
2005.02.13
Посмотрите кому интересно новую игру (rts 2.1Mb) rts111.narod.ru


3-1105955534
Максим
2005-01-17 12:52
2005.02.13
FireBird и SQL запрос





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский