Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted

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
 
Share this answer
 
v2
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...
 
Share this answer
 
Comments
Espen Harlinn 18-Jun-14 19:18pm    
Consider using C++/CLI to create a .Net integration layer for use with the commercial application's SDK. Then you'll be free to use any CLR language you want to create the actual UI.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900