PostMessage LPARAM trouble
I am trying to send a keystroke to another window via PostMessage. I can successfully run WM_KEYDOWN without my program crashing, but the other 3 messages fail.
As of now I'm sending 'a' to the other program. (0x00021e0*)
I created 0x00021e0* from the API documentation, but like I said the last 3 are failing.
#define SETBITS(var,mask) (var |= mask)
#define CLEARBITS(var,mask) (var &= ~mask)
#define CHKBITS(var,mask) ((var&mask) == mask)
void SendKey(char input)
short key = VkKeyScan(input);
UINT scancode = MapVirtualKey(key, 0);
PostMessage(lWnd, WM_KEYDOWN, key, lParam);
PostMessage(lWnd, WM_CHAR, key, lParam);
PostMessage(lWnd, WM_KEYUP, key, lParam);
So the first PostMessage() is obviously 0000. The second one that is not working is 0010, and the third is 0011.
Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.
Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.