保持窗口看起来活跃
我正在为辅助监视器开发任务栏。我让它运行得相当好。我还可以使用空气动力学模糊外观。但我的问题可能与航空方面的东西无关。
我想要做的是让我的任务栏窗口始终显示为焦点/激活状态。它不需要真正聚焦或激活,我只是希望它看起来像那样。您只需在应用程序空闲时调用 setforgroundwindow 即可看到我想要的效果。但我不能使用它,因为我真的不希望它像那样抓住焦点。我只是希望它始终保持焦点时的样子。
我尝试过各种 WM_XXX 消息调用,包括捕获和发送,我尝试过 setwindowpos 调用,等等。唯一有效的方法是调用 Mouse_Event(MOUSEEVENTF_LEFTDOWN ,然后调用 Mouse_Event(MOUSEEVENTF_LEFTUP )。虽然我不喜欢这个解决方案,因为它对我想做的事情来说是一个非常俗气的黑客/解决方法。但是使用 Mouse_Event 调用的任何内容本质上都是我只需要在不实际单击我的应用程序或向其发送 Mouse_Event 调用的情况下实现这一点。
I'm working on a taskbar for secondary monitors. I have it working fairly well. I've also got the aero blur look working as well. But my question is probably not related to the aero stuff.
What i want to do is to have my taskbar window to always appear focused/activated. It does not need to actually be focused or activated, I just want it to look that way. You can see the effect I'm after by just putting a setforgroundwindow call in the app idle. But I can't use that as I don't really want it grabbing the focus like that. I just want it to always look the way it does when it does have focus.
I've tried all sorts of WM_XXX message calls, both trapping and sending, I've tried setwindowpos calls, and on and on. The only thing that has worked is calling Mouse_Event(MOUSEEVENTF_LEFTDOWN and then Mouse_Event(MOUSEEVENTF_LEFTUP. I don't like this solution though as it's a really cheesy hack/workaround to what I want to do. But whatever gets called with the Mouse_Event is essentially what I need to make happen only without actually clicking on my app or sending it Mouse_Event calls.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有说明您正在使用什么语言,也没有说明这是托管代码还是非托管代码。
对于 C++ 非托管代码,您只需处理 WM_NCACTIVATE 消息并强制它始终看起来处于活动状态,如下所示:
编辑:delphi 代码中的解决方案(从注释中移出以使其更具可读性)
You don't say what language you are working in or whether this is managed or unmanaged code.
For C++ unmanaged code, you just handle the WM_NCACTIVATE message and force it to always seem active, like this:
edit: the solution in delphi code (moved from comment to make it more readable)