如何使用热键隐藏和显示我的winForm? [英] How do I use a hotkey to hide and show my winForm?

查看:110
本文介绍了如何使用热键隐藏和显示我的winForm?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个包含窗口中文本的winForm应用程序。当我启动我的winForm应用程序时,我想看到窗口,然后按一个热键来隐藏窗口。



然后再次按相同的热键显示窗口再次。所以我可以用一个热键切换窗口来显示和隐藏自己。



我不知道该怎么做。



我正在使用vs 2010 C ++和winForm应用程序。



感谢您的帮助和评论。

I want to create a winForm app that contains text in the window. When I start up my winForm app, I want to see the window and then press a hotkey to hide the window.

Then press the same hotkey again to display the window again. So I can toggle the window with one hotkey to show and hide itself.

I'm not sure how to go about doing this.

I'm using vs 2010 C++ and a winForm app.

Thanks for any help and comments.

推荐答案

本文解释了如何执行此操作:一个简单的C#全局低级键盘挂钩 [ ^ ]



你需要一个键盘钩来恢复窗口...



以下两篇文章演示了如何集成本机C ++代码和托管代码:

使用C ++ CLI使用ACE [ ^ ]



集成ACE和ATL [ ^ ]



使用C#,C ++ / CLI或任何其他支持CLR。



有关创建本机键盘钩子的信息:

使用挂钩 [ ^ ]

KeyBoard Hooks [ ^ ]



就个人而言,我更喜欢用C#做托管的东西 - 而你se P / Invoke,C ++ / CLI或COM访问本机功能。



祝你好运

Espen Harlinn
This article explains how to do it: A Simple C# Global Low Level Keyboard Hook[^]

You need a keyboard hook to restore the window ...

The following two articles demonstrates how you can integrate native C++ code and managed code:
Using ACE with C++ CLI[^]

Integrating ACE and ATL[^]

Develop your Windows Forms stuff using C#, C++/CLI, or any other language supporting the CLR.

Info about creating native keyboard hooks:
Using Hooks[^]
KeyBoard Hooks[^]

Personally I prefer to do managed stuff in C# - and use P/Invoke, C++/CLI or COM to access native functionality.

Best regards
Espen Harlinn


我正在使用仅支持C ++的vs 2010。 vs 2012和vs 2013不再支持在C ++中创建WinForm应用程序。我的应用程序需要挂钩到另一个商业应用程序的SDK并需要C ++才能进行接口。



感谢您的参考,但我需要C ++中的示例或示例。我对C#或C ++没有太多经验,所以尝试将其转换为C ++对我来说将是一个挑战。



谢谢......
I'm using vs 2010 which supports only C++. vs 2012 and vs 2013 no longer support creating WinForm apps in C++. My app needs to hook into another commercial application's SDK and requires C++ to interface.

Thank you for the reference but I need an example or examples in C++. I'm not very experienced with C# or C++ so trying to convert it over to C++ would be a challenge for me.

Thank you...


这篇关于如何使用热键隐藏和显示我的winForm?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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