窗口“切换到”执行
您好,我如何在我的应用程序中实现“切换到”功能,例如在 Windows 任务资源管理器中,任何人都可以给我有用的链接或响应如何做到这一点? 对所有人来说都有很多好处
Hi how can i implement "switch to" functional in my app like in windows task explorer, can any one give me useful link or response how to do it?
Tnaks a lot for all
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SetForegroundWindow 是更改的正常方法“当前任务”,对于“任务切换器”应用,SwitchToThisWindow 是一个更好的解决方案,因为它不需要您的应用程序处于“前台”(但是请不要滥用 SwitchToThisWindow 只是为了将您自己的应用程序带到前台)
如果这是一个类似 alt-tab 的应用程序,您可以使用 RegisterHotKey 进行注册对于特殊按键,以及 EnumWindows 枚举顶级窗口...
SetForegroundWindow is the normal way to change "current task", for "task switcher" apps, SwitchToThisWindow is a better solution since it does not require your app to be "foreground" (But please, don't abuse SwitchToThisWindow just to bring your own apps to the foreground)
If this is a alt-tab like application, you can use RegisterHotKey to register for a special key press, and EnumWindows to enumerate top-level windows...
使用 User32.dll 中的
SwitchToThisWindow()
Windows API 函数。使用EnumWindows()
或FindWindow()
获取窗口句柄,然后将其传递给SwitchToThisWindow()
以切换到应用程序。Use the
SwitchToThisWindow()
Windows API function in User32.dll. Get a handle to the window usingEnumWindows()
orFindWindow()
, then pass it toSwitchToThisWindow()
to switch to the app.