使用.NET 操作其他应用程序的窗口?
是否可以通过我自己的.NET(Windows 7)代码来操纵另一个正在运行的应用程序的窗口? 我经常使用 PuTTY,并且发现如果我可以编写一个添加快捷键的程序,它会非常有帮助,该快捷键的作用与右键单击 Windows 7 中的任务栏并选择“并排显示窗口”但不适用于所有窗口相同。仅适用于每个打开的 PuTTy 实例,因此我可以概述每个打开的 shh 连接。 我希望这听起来不会令人困惑。 无论如何,为了实现这一点,我需要能够操作其他窗口(在本例中为 PuTTY 窗口),例如调整它们的大小、移动、显示/隐藏等。
如果可能的话,我想坚持使用 C#,而不是 C/C++
提前致谢!
is it somehow possible to manipulate a window of another running application with code in my own with .NET (Windows 7)?
I often use PuTTY and would find it very helpful if I could write a program which adds key shortcut which does the same as right clicking the taskbar in Windows 7 and choosing "Show windows side by side" but not for all windows. Just for every open instance of PuTTy, so I have an overview of every open shh connection.
I hope this doesn't sound to confusing.
Anyway, to achiev this, I need to be able to manipulate other windows (in this case the PuTTY windows), e.g., resizing, moving, showing/hiding, etc., them.
If at all possible, I'd like to stick with C#, not C/C++
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这绝对应该是可能的,但需要一整套平台调用。要调用的相关 WINAPI 函数为 EnumWindows 检索所有顶级窗口,GetWindowInfo 检索位置、大小和标题每个窗口的最后 MoveWindow 移动适当的窗口并调整其大小。
祝你好运!
This definitely should be possible, but will need a whole arsenal of platform invokes. The relevant WINAPI functions to invoke would be EnumWindows to retrieve all top-level windows, GetWindowInfo to retrieve the location, size and title of each window and finally MoveWindow to move and resize the appropriate windows.
Good luck!