Secondly, how do I hide the console window but have the C++ program active? You'll get to know why I want this in the next paragraph. |
The simple answer is - don't run it from a console window. Most OS's have a way to automatically start an application when the OS starts, or when the user logs on, for example. Or else, you can have it started by clicking a desktop icon, but have no visible GUI.
And lastly how do I bind keyboard events? Like a certain combination ctrl+a, or say even just the key 'a'. So every time I press this key, a certain part of the C++ program must execute? Remember that C++ would be in the background so it must work even thought it's not the active window. |
I would be extremely wary of hijacking keyboard events to perform actions in a program, when that program isn't active, because that's basically changing the way the user interacts with other applications, and with the OS itself.
In your example, what if I'm editing a document, and I type "Ctrl-A" because I know that's the convention (on Windows) for selecting all the text. Suddenly, that no longer works, because you've hijacked that key combo for your own app that's running in the background. You've taken away part of the functionality of something else I'm used to using.
Now, there's probably a way to forward that event onto the active app, so your program does whatever Ctrl-A makes it do, and then my editor also gets the Ctrl-A to select all the text. But your app has no idea what I wanted that Ctrl-A to do. Did I do it because I wanted to select all text? Did I do it because I wanted your app to do whatever it does on Ctrl-A? Did I do it because I wanted to do both?
Your proposal would change the way a user expects to be able to interact with their other software, and with their OS, in ways that are likely to be confusing and frustrating. I would avoid doing that.