Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
Acmlm's Board - I3 Archive - - Posts by Vertex |
User | Post | ||
Vertex Newcomer Since: 01-08-06 From: Philippines Last post: 6745 days Last view: 6745 days |
| ||
Are you absolutely sure that you are providing a valid hWnd? And if you're using the unicode version of GWMFN() then are you sure it's not returning a unicode string and your program is trying to interpret it as ANSI? | |||
Vertex Newcomer Since: 01-08-06 From: Philippines Last post: 6745 days Last view: 6745 days |
| ||
The problem is, if you're going to check the mouse is down, and you need to simulate mouse clicking (mousedown + mouseup) then you're not going to be able to tell when the actual mouse is down, because you'll be setting the mouse button state to 'up' every 20ms.. it would work if you just simulated mousedown over and over though, so I'll demonstrate that.
Another idea would be to get the hWnd of the game's input thread window, and just PostMessage to it every 20ms while the mouse is down. Due to the way Timers work in Win32 it might just be easier to create a thread with a consitent loop. void MouseCheckThread(void) { INPUT i; i.dwType = INPUT_MOUSE i.mi.dx = i.mi.dy = 0; i.mi.mouseData = 0; i.mi.dwFlags = MOUSEEVENTF_LEFTDOWN; i.mi.time = 0; i.mi.dwExtraInfo = 0; while (!bThreadShouldEnd) { if (GetKeyState(VK_LBUTTON) & 0x8000) SendInput(1, &i, sizeof(i)); Sleep(20); // just so it doesn't eat up your processor time } } That will check every 20ms if the left mouse button is down, and if it is, send an input message to the system that the mousebutton is being clicked again. If you get the window handle, you can do this: void MouseCheckThread(HWND hWndInputThread) { while (!bThreadShouldEnd) { if (GetKeyState(VK_LBUTTON) & 0x8000) PostMessage(hWndInputThread, WM_LBUTTONDOWN, MK_LBUTTON, (LPARAM)0x00000000); Sleep(20); // just so it doesn't eat up your processor time } } Hopefully this will help you. Sorry about the bad formatting (edited by Vertex on 01-08-06 09:43 PM) (edited by Vertex on 01-08-06 09:45 PM) |
|||
Vertex Newcomer Since: 01-08-06 From: Philippines Last post: 6745 days Last view: 6745 days |
| ||
I'm not sure if this is what you're talking about, as I don't use MFC due to huge bloat and speed problems- but there is an API called RegisterMessage, is that it? | |||
Vertex Newcomer Since: 01-08-06 From: Philippines Last post: 6745 days Last view: 6745 days |
| ||
Could you post the code you are using to get the hWnd and process module filename? |
Acmlm's Board - I3 Archive - - Posts by Vertex |