Quote Originally Posted by 'Madman_Max',index.php?page=Thread&postID=120070#p ost120070
Frequently, the background window received the keystroke, but fails to execute it until I manually click on the background window or press another hotkey.
That's a good observation. The next step is to distinguish whether it's really failing to execute or whether it's executing but the screen isn't getting redrawn. You can see the difference if your command makes the character do something visible in the game and you watch it from the other character's screen. (SendWinX turns off screen redraws for a background window while it sends keystrokes to the background.)

This may seem like a meaningless distinction but it's crucial for me know whether I have to worry about the keystroke getting received by the game or whether I have to improve the part of the code that forces a screen redraw.

I forgot to mention this. Indeed the background window is sometimes recieving the keystrokes but failing to execute them. After being away from the computer for a few minutes I came back and clicked on a background window and the keystoke executed. It seems like they are being cached in a unreliable buffer associated with the background app.

I tested by sending the keystokes 5 and 6 which I had bound to verbal emotes on the ingame action bar, also sent Space for jumping. All cases seem to produce the same types of errors. Same thing happens when sending key to chat window in the background app.



Interesting idea. The way SendWinX works, it raises the background window to the foreground in the normal way, except it turns off screen redraw for a moment so there's no delay while the video card moves windows around. When a window gains the foreground, the operating system elevates its thread priority automatically, so the operating system is already doing this also.


I was trying to find a way to force a redraw, thinking perhaps that would yield different results. Didn't have any luck with the commands that I used. What are the proper commands to force a redraw, or is that possible at this time?


Quote Originally Posted by 'Madman_Max',index.php?page=Thread&postID=120070#p ost120070
If I alternate pressing F1 and F2, the background window will work correctly, open either the backpack or help window out of sequence, or do nothing at all.
Thanks for this observation. I'll look at this. (I suspect the out of order part may be due to delayed redraws. In other words, the keys may be doing their jobs immediately, but you don't see the results until later.)


In my original example, it seemed to me that the "out of order" problem was due to key H being buffered, the subsequent key B takes its place in the buffer expelling H out of the buffer into the execution process. Perhaps this "buffer" is being shared by some other process, leading to unreliable results. Again, this doesnt seem to be just a redraw issue since "space" commands for jumping, and numbers bound to action bars produce the same errors.

All purely speculation from a layman's point of view :-)