February 11th, 2011, 10:19 AM
[RESOLVED] SendMessage for a game
I'm part of a MMORPG gaming community. Some time ago I decided to write a very simple but useful tool for the players. Let me tell you how should it work ideally. As a generic MMORPG one of its parts is levelling up, namely just holding down right mouse button while your character kills monsters around it. You can even put something on your right mouse button and go outside, but unfortunately you will have to buy a new mouse quite often then. It would be very good to hide the game and let players browsing Internet while their character is levelling up. So, this is an abstract algorithm of my application actions:
1. User starts the procedure by hitting a "start" key
2. Hide the game window and send a right mouse button signal to it
3. User does whatever he wants, e.g. doing his homework on PC, but nothing should stop the right mouse button signal in the game window
4. User stops the procedure by hitting a "stop" key
5. Restore the game window and stop "holding" right mouse button in it
This tool is legit, it's not a bot, because the levelling is not the most important part of the game. Also, the game has an anti-cheat system.
So, I divided my task to few small functions and started to write them, but I have problems with it. I was trying to test a part which should send right mouse button signals if user presses a key. Assuming that hMU is the valid handle to the game window, this is my WndProc
The problem is that nothing happens when I press F11 or F12. Neither PostMessage, SendMessage, nor SendInput worked for me (I used SendInput for testing only, it's definitely not what I need for my application). Why it is so, what should I do for reaching my goal? I'm using GNU C compiler.
LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
if (wParam == VK_F11)
SendMessage(hMU, WM_RBUTTONDOWN, 0, 0);
else if (wParam == VK_F12)
SendMessage(hMU, WM_RBUTTONUP, 0, 0);
return DefWindowProc(hWnd, Msg, wParam, lParam);
Any help will be greatly appreciated. Thank you!
P.S. I'm sorry for my English which is far from good, and also I'm sorry for the lenght of my post, however I tried to make it smaller.
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!