窗口及其关联的任务栏按钮之间的关系 [英] Relationship between a window and its associated taskbar button

查看:74
本文介绍了窗口及其关联的任务栏按钮之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




这实际上只是一个理论问题,对我自己的兴趣,而不是

任何邪恶的目的......: - )


假设我们有三个应用程序正在运行 - 记事本,写字板和Excel - 并且

每个窗口都处于正常状态。状态即没有最大化,并且没有最小化

到任务栏。


我们依次点击三个任务栏按钮中的每一个,当然,三个

应用程序一个接一个地获得焦点...我们点击记事本

任务栏按钮,记事本获得焦点。显然!


同样,如果我们依次点击每个应用程序,它们相关的

任务栏按钮会缩进,即好像已被点击。


我的问题是,Windows如何将应用程序与其关联的

任务栏按钮相关联?即当你点击记事本时,Windows如何知道

哪个任务栏按钮缩进?我假设它必须使用hWnd ......?


假设确实如此,有没有办法发现应用程序的任务栏

按钮'来自应用程序本身的hWnd?


感激不尽的任何帮助。

-

Mark Rae

ASP.NET MVP
http://www.markrae。网

解决方案

" Mark Rae [MVP]" < ma ** @ markNOSPAMrae.netwrote in message

news:%2 **************** @ TK2MSFTNGP05.phx.gbl ...


我的问题是,Windows如何将应用程序与其关联的

任务栏按钮相关联?即当你点击记事本时,Windows如何知道

哪个任务栏按钮缩进?我假设它必须使用

hWnd ...?


假设确实如此,有没有办法发现应用程序的任务栏

按钮'来自应用程序本身的hWnd?



嗯,不幸的是,没有microsoft.public.win32.programmer.shell

组,所以最接近的可能是微软.public.win32.programmer.ui。

我在那里看过托盘问题,所以也许任务栏的问题也很好。

也适合那里。我绝对认为你需要在这个上面询问

..NET组。但请报告你的发现!我也在理论层面上发现这个

很有趣。我甚至无法想到我将如何使用它,但知道它会很酷。


然而,我的预测是信息存储在内部结构中

并且不会公开。粗略地看一下与appbar相关的东西并不会显示任何与按钮相关的功能或消息。


" Jeff Johnson" ; < i。*** @ enough.spamwrote in message

news:OG ************** @ TK2MSFTNGP03.phx.gbl ...


>我的问题是,Windows如何将应用程序与其关联的
任务栏按钮相关联?即当你点击记事本时,Windows如何知道
哪些任务栏按钮缩进?我假设它必须使用
hWnd ......?

假设确实如此,有没有办法发现应用程序的任务栏
按钮'' hWnd从应用程序本身的hWnd?



嗯,不幸的是,没有microsoft.public.win32.programmer.shell

组,所以最接近的可能是微软.public.win32.programmer.ui。

我在那里看过托盘问题,所以也许任务栏的问题也很好。

也适合那里。我绝对认为你需要在这个上面询问

.NET组。但请报告你的发现!我也在理论层面找到了这个有趣的东西。我甚至无法想到我将如何使用它,但是知道它会很酷。



好​​的 - 我会尝试更合适的新闻组...


但是,我的预测是信息存储在内部结构中

并且不会暴露。粗略地看一下与appbar相关的东西并不会显示任何与按钮相关的功能或消息。



获取任何正在运行的应用程序的任务栏按钮(相对)

可以通过一大堆p / invoke调用轻松实现不安全

代码:
http://www.codeproject.com/KB/shell/taskbarsorter.aspx


我无法想象Windows每次都会经历这一切

有人点击任务栏按钮或正在运行的应用程序窗口...

-

Mark Rae

ASP.NET MVP
http://www.markrae.net


" Mark Rae [MVP]" < ma ** @ markNOSPAMrae.netwrote in message

news:uU ************** @ TK2MSFTNGP03.phx.gbl ...
< blockquote class =post_quotes>


>但是,我的预测是信息存储在内部
结构中并且不会公开。粗略地看一下与appbar相关的东西并没有透露任何与按钮相关的功能或消息。



获取任何正在运行的应用程序的任务栏按钮(相对)

可通过一大堆p / invoke调用轻松实现

不安全代码:
http://www.codeproject.com/KB/shell/taskbarsorter.aspx



Egad。我经常使用一个名为TaskArrange的实用程序,它就是这样做的!我不能相信我忘记了这一点。嗯,那很酷。


Hi,

This is really just a theoretical question for my own interest, and not for
any nefarious purpose... :-)

Say we have three applications running - Notepad, Wordpad and Excel - and
each window is in its "normal" state i.e. not maximised, and not minimised
to the taskbar.

We click each of the three taskbar buttons in turn and, of course, the three
applications receive focus one after the other... We click on the Notepad
taskbar button, and Notepad receives focus. Obviously!

Similarly, if we click each of the applications in turn, their associated
taskbar button appears indented, i.e. as if it has been clicked.

My question is, how does Windows relate an application to its associated
taskbar button? I.e. when you click on Notepad, how does Windows "know"
which of the taskbar buttons to indent? I''m assuming it must use a hWnd...?

Assuming it does, is there any way to discover an application''s taskbar
button''s hWnd from the hWnd of the application itself?

Any assistance gratefully received.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

解决方案

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...

My question is, how does Windows relate an application to its associated
taskbar button? I.e. when you click on Notepad, how does Windows "know"
which of the taskbar buttons to indent? I''m assuming it must use a
hWnd...?

Assuming it does, is there any way to discover an application''s taskbar
button''s hWnd from the hWnd of the application itself?

Hmmm, unfortunately there''s no microsoft.public.win32.programmer.shell
group, so the closest thing might be microsoft.public.win32.programmer.ui.
I''ve seen tray questions there, so perhaps a taskbar question would be
well-suited there too. I definitely think you need to ask outside of the
..NET groups on this one. But please report your findings! I, too, find this
interesting on a theoretical level. I can''t even think of how I might ever
use it, but it''d be cool to know.

However, my prediction is that the info is stored in an internal structure
and is not exposed. A cursory glance of the appbar-related stuff doesn''t
reveal any functions or messages that relate to buttons.


"Jeff Johnson" <i.***@enough.spamwrote in message
news:OG**************@TK2MSFTNGP03.phx.gbl...

>My question is, how does Windows relate an application to its associated
taskbar button? I.e. when you click on Notepad, how does Windows "know"
which of the taskbar buttons to indent? I''m assuming it must use a
hWnd...?

Assuming it does, is there any way to discover an application''s taskbar
button''s hWnd from the hWnd of the application itself?


Hmmm, unfortunately there''s no microsoft.public.win32.programmer.shell
group, so the closest thing might be microsoft.public.win32.programmer.ui.
I''ve seen tray questions there, so perhaps a taskbar question would be
well-suited there too. I definitely think you need to ask outside of the
.NET groups on this one. But please report your findings! I, too, find
this interesting on a theoretical level. I can''t even think of how I might
ever use it, but it''d be cool to know.

OK - I''ll try a more appropriate newsgroup...

However, my prediction is that the info is stored in an internal structure
and is not exposed. A cursory glance of the appbar-related stuff doesn''t
reveal any functions or messages that relate to buttons.

Getting the taskbar button for any running application is (relatively)
easily achievable through a whole slew of p/invoke calls and a bit of unsafe
code:
http://www.codeproject.com/KB/shell/taskbarsorter.aspx

I just can''t imagine that Windows is going through all of this every time
someone clicks a taskbar button or a running application''s window...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uU**************@TK2MSFTNGP03.phx.gbl...

>However, my prediction is that the info is stored in an internal
structure and is not exposed. A cursory glance of the appbar-related
stuff doesn''t reveal any functions or messages that relate to buttons.


Getting the taskbar button for any running application is (relatively)
easily achievable through a whole slew of p/invoke calls and a bit of
unsafe code:
http://www.codeproject.com/KB/shell/taskbarsorter.aspx

Egad. I regularly use a utility called TaskArrange, which does just this! I
can''t believe I forgot about that. Well, that''s cool then.


这篇关于窗口及其关联的任务栏按钮之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆