如何最小化任何打开的应用程序(所需结果的 AHK 示例)
我正在尝试编写一段代码来最小化基于标题栏中显示的文本的应用程序(系统上运行的任何应用程序,而不仅仅是我自己的应用程序)。我已经能够在 AHK 中执行该任务,但所需的结果并不理想,我肯定宁愿它是我的应用程序的一个活动部分,而不是外部部分。 AHK 是:
#Persistent
#SingleInstance
SetTimer, NoCashierOrHEM, 300
return
NoCashierOrHEM:
IfWinExist , Cashier
WinClose , Cashier
IfWinExist , Hold’em + Omaha Manager
WinMinimize , Hold’em + Omaha Manager
return
它将最小化任何标题栏为“Hold'em + Omaha Manager”的窗口,并关闭任何标题栏为“Cashier”的窗口。在 C# 中解决这个问题我应该寻找什么方向?
I'm trying to write a piece of code to minimize an application based on the text displaying in the title bar (any application running on the system, not just my own). I've been able to perform the task in an AHK but the desired result isn't ideal and I'd definitely rather it be an active piece of my application then an external one. The AHK is:
#Persistent
#SingleInstance
SetTimer, NoCashierOrHEM, 300
return
NoCashierOrHEM:
IfWinExist , Cashier
WinClose , Cashier
IfWinExist , Hold’em + Omaha Manager
WinMinimize , Hold’em + Omaha Manager
return
Which will minimize any window that has the title bar "Hold'em + Omaha Manager" and close any window that has the title "Cashier". What direction should I be looking in for solving this problem in C#?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将需要使用 Windows API 函数的组合,例如
GetClassName
获取WindowsText
GetWindow
并编写一个方法来遍历打开的表单并搜索文本。
可以在此处找到 vb6 的示例。
我相信代码应该很容易转换为 C#。
You will need to use a combination of Windows API functions, like
GetClassName
GetWindowsText
GetWindow
and write a method that goes through open forms and searches for the text.
An example in vb6 can be found here.
I believe that code should be fairly easy to convert to c#.