Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Triggers for a specified window often fail
#1
Hi,

I assigned a middle mouse button trigger to Macro [Desk_Dia], which only takes effect when the desktop area  the middle mouse is pressed

However, when I have used the middle mouse button in other programs [For example in Google Chrome],

when I back to the desktop and press the middle mouse button, the trigger fails, I need to open the QM window so that the trigger takes effect again

Thanks for any advice and help
david

Function Middle_Click_FF
Trigger #M //Middle_Click_FF     Help - how to add the trigger to the macro
Code:
Copy      Help
;/

function# iid FILTER&f

str Win_1="Program Manager" ;;When the middle key is pressed on the desktop
str Win_2="" ;;
str Win_3="" ;;
str Win_4="" ;;

sel wintest(f.hwnd F"{Win_1}[]{Win_2}[]{Win_3}[]{Win_4}" "" "" 16)
,case 1 ret "Desk_Dia" ;;Win_1
,case 2 ret "" ;;Win_2
,case 3 ret "" ;;Win_3
,case 4 ret "" ;;Win_4

ret -2


Macro Desk_Dia
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog" "4"
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040C02 "*" "" "" ""

if(!ShowDialog(dd 0 0)) ret
#2
Tested on Windows 11.

Insert this in the FF to see the current window:
outw f.hwnd

When a window is active, it is
65888 Progman "Program Manager" EXPLORER

When I press Win+D to show desktop, the window is
788796 WorkerW "" EXPLORER

Both windows belong to the same thread (desktop thread?), therefore can be used this code:
Code:
Copy      Help
;outw f.hwnd
;out F"{GetWindowThreadProcessId(f.hwnd 0)} {GetWindowThreadProcessId(GetShellWindow 0)} {GetShellWindow}"
if GetWindowThreadProcessId(f.hwnd 0) = GetWindowThreadProcessId(GetShellWindow 0)
,ret "Desk_Dia" ;;Win_1
#3
When the QM window opens, press the middle mouse button on the desktop, and the trigger succeeds,  output the following information (window7 64bit)
65794 Progman "Program Manager" EXPLORER

When I close or minimize the QM window, and then in the chrome browser to operate the middle mouse button and other operations, back to the desktop, press the middle mouse button, the trigger fails, there is no reaction

At this point, I open the QM window, go back to the desktop, press the middle mouse button, and the trigger succeeds

In addition, I often encounter a problem, code modifications can not take effect immediately, need to restart QM to take effect, this problem, often appears,

When QM is open in the current window, the Middle Mouse Button trigger is always in effect
#4
Then I don't know what it could be. Can't reproduce. Then all mouse triggers don't work? Without filter functions too?

About code modifications: just click the Compile button. In some cases QM does not auto-compile as it could be dangerous if there were errors etc.
#5
Then all mouse triggers don't work? 
NO, Other mouse triggers work! 

if QM is opening and Visible, the Middle Mouse Button trigger is always in effect on desktop

Should be WIN+D case, the trigger is invalid, how to solve? Smile

The current code:
Code:
Copy      Help
sel wintest(f.hwnd F"{Win_1}[]{Win_2}[]{Win_3}[]{Win_4}" "" "" 16)
,case 1
,outw f.hwnd
,out F"{GetWindowThreadProcessId(f.hwnd 0)} {GetWindowThreadProcessId(GetShellWindow 0)} {GetShellWindow}"
,if GetWindowThreadProcessId(f.hwnd 0) = GetWindowThreadProcessId(GetShellWindow 0)
,,ret "Desk_Dia" ;;Win_1
#6
Function Middle_Click_FF
Trigger #M //Middle_Click_FF     Help - how to add the trigger to the macro
Code:
Copy      Help
;/
function# iid FILTER&f

str Win_2="" ;;
str Win_3="" ;;
str Win_4="" ;;

;outw f.hwnd
;out F"{GetWindowThreadProcessId(f.hwnd 0)} {GetWindowThreadProcessId(GetShellWindow 0)} {GetShellWindow}"
if GetWindowThreadProcessId(f.hwnd 0) = GetWindowThreadProcessId(GetShellWindow 0)
,ret "Desk_Dia" ;;Win_1

sel wintest(f.hwnd F"{Win_2}[]{Win_3}[]{Win_4}" "" "" 16)
,case 2 ret "" ;;Win_2
,case 3 ret "" ;;Win_3
,case 4 ret "" ;;Win_4

ret -2
#7
Thanks for your help, Works well now!


Forum Jump:


Users browsing this thread: 1 Guest(s)