I want to develop a C program which when double clicked will press both Ctrl+B key combined
This is a discussion on C program to press keyboard keys within the Windows Programming forums, part of the Platform Specific Boards category; I want to develop a C program which when double clicked will press both Ctrl+B key combined...
I want to develop a C program which when double clicked will press both Ctrl+B key combined
What do you mean by your program being "double clicked"?????
A C program cannot press keyboard keys, unless it controls some physical agent (hardware, biological, etc) that performs the physical act.
If you want a program that can simulate keystrokes as input to another program (i.e. get another program to act as if the user has hit those keys) the techniques depend on your operating system and compiler/library.
Right 98% of the time, and don't care about the other 3%.
I am using windows xp. I actually wanted a .exe file which when executed will press the keys CTRL+B in the desktop(this key is the boss key of my bittorrent software)
Pressing ctrl-b will be a lot quicker than fumbling around for an exe file to do the same.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.
It would be lot easier but i want it to be done in startup of windows xp
That implies you're running bittorrent at startup too. If so, simply start it minimised. No need to have another program do that.
Of course, if you're trying to conceal your downloading of porn from an employer, hiding bittorrent is not enough. Employers who care to can easily monitor your internet usage without touching your desktop computer, since they have control of the networking infrastructure that your computer connects to.
Right 98% of the time, and don't care about the other 3%.
They seem dumb at that level. But they can check the taskbar. Any way do my problem has any solution "pressing keystroke in windows xp desktop using C function
This is something that is actually pretty difficult to find through google and such (at least it was for me when I looked for it a long time ago, took me ages to find).
Look into Windows Function keybd_event() or get the window handle and SendMessage.
You'll also have to take into account keyboard focus (in the first method).
EDIT: As already mentioned by other posters, this is a very unclean way to do it, but it should do the job I guess. If it can be avoided, it should be.
Last edited by DeadPlanet; 03-25-2010 at 08:46 AM.
Thanks
It is solved for now
I will try not using these