Ok so I might be totally barking up the wrong tree here as I'm not that up to date on Windows programming but here goes.
I'm trying to initiate a simulated keypress in a C++ project in Visual Studio 2010.
Essentially when the program receives a specific code string from another application (which is all being worked via many if statements, messy but works)
I need it to perform the same function as if I pressed control and s on my keyboard.
Now some code I found was this.
keybd_event(VK_LCONTROL,0,0,0);
keybd_event(bKey, 0, 0, 0);
keybd_event(bKey, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_LCONTROL,0,KEYEVENTF_KEYUP,0);
Whereby bKey is the appropriate ASCII code for S, it escapes me off hand but still, it's mostly irrelevant to this post.
What this should do by my understanding of it is
Push Control down
Push S down
Release S
Release Control.
However it does not seem to do this, it seems to only push down and release S thereby printing S as appropriate or not depending if text entry is available at the time.
Am I barking up the wrong tree altogether here? I know how to do this in Objective C in Xcode but the two seem quite radically different, I know they're different systems but still.
Can anyone propose a solution to this? Basically a way to make the program hit Control + S together (not one after the other, together).
Any help is much appreciated. There seems to be a lot of conflicting information out there.