Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with low level triggers
#1
I am using low level mouse and keyboard triggers but after about 10 -30 minutes, they quit working. Or maybe it is 10-30 uses. I have not been able to pin it down. I have a start menu item that restarts qm and thereby gets the triggers working again. This is an imperfect solution to the problem. I have also found that if I go into tool--> options --> and uncheck "use low level triggers" then apply then recheck "low level triggers" and apply, everything works again for awhile.

I have gotten rid of the low level trigger option and everything works fine, I believe. However, I need the low level trigger for, among other things, stealing input from a citrix window.

An example of a function that fails but that I find very useful follows. It moves the mouse to the middle of the active windows when triggered by alt-Tab. You need this with multiple large monitors and a mouse that can only move so fast. The function fires when the key is released and is set to not eat the key:

Function MoveMouseToActiveWindow2
Trigger AT 0x5     Help - how to add the trigger to the macro
Code:
Copy      Help
RECT r
GetWindowRect(win() &r)
mou (r.left + ((r.right - r.left)/2)) (r.top + ((r.bottom - r.top)/2))

I am using QM 2.4.2.2 but have had the problem in a previous version as well.

I had considered a less than ideal solution to the problem, where, every 10s or so, qm issued keystrokes that should trigger a qm function and when the triggering failed, qm would disable then re-enable the low level hooks. Something like this might even help me to pin down when the problem is occurring, by actively monitoring for it. If a solution to the primary problem is not obvious (which is what I expect) then is there a way for QM to trigger itself through the low level keyboard hooks as I am describing. Then how can I programmatically disable, then reenable them. I might be able to figure this last one out but I have looked around for sending keystrokes from QM that trigger other QM items via the windows keyboard hooks and have not had success.

Thanks for your help.
#2
To send keys that can trigger QM macros, use a function like KeyWithPreciseSpeed:
autodelay — spe and slowkeys — time estimation

To restore broken hooks, use function RestoreTriggers.

In RestoreTriggers help you can read about why hooks stop working:
Quote: Possible reasons of broken hooks:
1. Some other program uses hooks incorrectly, or its hooks interfere with QM. Can be even a QM macro that uses SetWindowsHookEx incorrectly.
2. Small LowLevelHooksTimeout value in registry HKEY_CURRENT_USER\Control Panel\Desktop. Should be >=5000 (5000 is default). You can find more info on the Internet.
#3
Thanks for the quick response! This is just what I needed. I suspect that setting the LowLevelHooksTimeout is going to be my solution as I think the problem has gotten worse as my computer has gotten slower. I attribute that to the fact that I am now driving two 4k monitors with USB display adapters. When I throw in one or two windows virtual machines, I am looking at 10-20% CPU utilization all the time.

However, I am quite pleased to see these other options you have described as well.

By the way, I just wanted to tell you that I believe you have written the nicest piece of development software I have used since perhaps working on a Symbolics Lisp Machine back in the 80's. And then there is this forum with the most intelligent, clear, knowing responses I have seen anywhere on software issues. I have wanted to write this, easily for 5 years, but until now I was mostly able to solve my own problems, so no posts.


Forum Jump:


Users browsing this thread: 1 Guest(s)