Hotkeys Problems

Find a Bug? Have a Problem? Like to Suggest a Feature? Do it Here

Moderators: g3nuin3, SpeedWing, WhiteHat, mezzo

Hotkeys Problems

Postby daenerys » Tue Mar 27, 2007 3:24 pm

Hi,

I have some problems with the hotkeys which I bind to my script functions. I have noticed that the mouse buttons work only if the poll method is used, otherwise they do not work. Is there a reason behind or is it a bug?
I have also noticed that e.g. in BF2, if I define a mouse button and another keyboard hotkey (e.g. both with the poll method, or only the mouse button with the poll method), both hotkeys are working (the functions are executed) if the Memory Hacking window is focused. But if the BF2 window is focused, the keyboard hotkey doesn't work, only the mouse hotkey does. Is there again a reason behind or is it a bug?
Generally I have problems in case I have more than one hotkey bind to the script functions, regardless of the polling method setting. This leaves me in fact only one hotkey that I can bind to a script, what is not sufficient for my "application"...
Can you please give more infos how these hotkeys are implemented? Are there any other workarounds where I can check which keys are pressed (keyboard and mouse)?

The MH version I use is the 3.0.1.4 Pro.

Thanks,
danny
daenerys
Hackleberry Fin
 
Posts: 25
Joined: Wed Jul 26, 2006 6:21 pm

Postby L. Spiro » Tue Mar 27, 2007 4:08 pm

I have noticed that the mouse buttons work only if the poll method is used, otherwise they do not work. Is there a reason behind or is it a bug?

Mouse buttons may not be set as Windows® hotkeys.


I have also noticed that e.g. in BF2, if I define a mouse button and another keyboard hotkey (e.g. both with the poll method, or only the mouse button with the poll method), both hotkeys are working (the functions are executed) if the Memory Hacking window is focused. But if the BF2 window is focused, the keyboard hotkey doesn't work, only the mouse hotkey does.

Battlefield 2 is catching the key events before Memory Hacking Software, and it is possible that there is no solution.


Generally I have problems in case I have more than one hotkey bind to the script functions, regardless of the polling method setting. This leaves me in fact only one hotkey that I can bind to a script, what is not sufficient for my "application"...

Can you please give more infos how these hotkeys are implemented? Are there any other workarounds where I can check which keys are pressed (keyboard and mouse)?

In the version you are using, only the first polling hotkey is scanned.
This bug was fixed in the demos.

Only the demos are supported as there were too many problems with the actual releases from long ago.



Polling method sets a second thread to poll repeatedly for the keys being hit using GetAsyncKeyState(), however as mentioned it will only poll the first hotkey set due to a bug in the old versions.
The standard method uses SetHotKey() and catches the WM_HOTKEY message.


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan

Hotkeys Probems, now with threads in 19.Q

Postby daenerys » Sun Apr 01, 2007 5:32 am

Hi L. Spiro,
I have changed to 19.Q and wanted to make use of the threads. I have made one thread which scans (or not) some memory values (in an endless loop) depending on a global var which is toggled via another hotkey script. The thread was started also with the same hotkey script (but only once, at the begining). Now I am noticing that the hotkey reaction is sporadic, e.g. I have to press several times (from 1x to say 5x) in order to get into the hotkey script function. Without the started thread, everything is OK, the hotkey script responds every time I press the hotkey.

What could be the problem here?

Thanks,

danny
daenerys
Hackleberry Fin
 
Posts: 25
Joined: Wed Jul 26, 2006 6:21 pm

Postby L. Spiro » Sun Apr 01, 2007 11:33 am

The thread created by your script runs at normal priority, causing lower-priority threads to be blocked more often.
You don’t have to hit it more times. You have to hold the button longer so the polling thread can see the button press, because it is running more slowly after your script thread starts.

I intend to fix this by adding the SetThreadPriority() function so you can run your background threads at a lower priority to avoid problems with the other threads in the system.
I didn’t do it yet because I have to set up a mechanism to set the thread back to its normal priority when it exits back to the system.


You can use the other hotkey method for better results, unless the polling method is required for your needs.


L. Spiro
User avatar
L. Spiro
L. Spiro
 
Posts: 3129
Joined: Mon Jul 17, 2006 10:14 pm
Location: Tokyo, Japan


Return to Bugs/Problems/Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests