SendMessage (WM_KEYDOWN, WM_KEYUP)

Hello all! First post, so please be gentle ;) :-P

I’m at work right now, I’ll post a picture of my patch later, but basically I’m having a problem where I’m trying to use the SendMessage patch to send WM_KEYDOWN and WM_KEYUP messages to a game I’d like to remote control. My FTIR table is working pretty well, and I’ve got the contour detection and everything set up. Everything goes well, until it tries to use SendMessage to send to LiquidWars (the game / program I’m trying to simulate keystrokes in).

Watching the messages that LiquidWars is receiving, WM_KEYDOWN has absolutely no problems. (The message is 256, wParam is 37 thru 40 depending on the arrow key, and lParam is below 268435455 (0x0FFFFFFF)). I specifically mention the lParam because when trying to send the WM_KEYUP message, in which the message is 257, wParam 37-40, lParam is at least 3221225472 (0xC0000000)… Spy++ reports LiquidWars as receiving an lParam of 0x80000000.

I’m sorry if that’s a bit convoluted, but it’s the best way I could figure to express my problem.

A friend at work suggested that it’s because the higher bits of the lParam are reserved for the OS; this doesn’t make sense to me, because then I wouldn’t be able to simulate the correct message, ever. I think it might be because vvvv stores 8 bytes as positive or negative, so instead of going from 0x0 - 0xFFFFFFFF, it goes from … say, -0x7FFFFFFF to 0x80000000.

Any ideas on this? I don’t want to have to create an external program (yet) just to send that one message to LiquidWars. Please let me know, and thanks very much in advance! vvvv rules!

you could try to use Keyboard (Global) which has an surprising input which can be used to send keystrokes to the frontmost app. you can set the frontmost app with the ShowWindow Node.

you are right expecting vvvv to need the decimal value 3221225472 for sending 0xC0000000.

without looking at the code i can think of a bug which would involve internally sending a signed integer instead of an unsiged one.

so you could see if sending the same bit pattern as 0xC0000000 interpreted as a signed int32 would give the desired result.

N = N* - power(2,32) = -1073741824

so try sending -1073741824