Posts: 1,031
Threads: 246
Joined: Jul 2022
08-05-2022, 07:16 PM
(This post was last modified: 08-05-2022, 07:46 PM by Davider.)
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
;/
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
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
Posts: 12,073
Threads: 140
Joined: Dec 2002
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:
;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
Posts: 1,031
Threads: 246
Joined: Jul 2022
08-06-2022, 05:39 AM
(This post was last modified: 08-06-2022, 05:54 AM by Davider.)
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
Posts: 12,073
Threads: 140
Joined: Dec 2002
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.
Posts: 1,031
Threads: 246
Joined: Jul 2022
08-06-2022, 06:02 AM
(This post was last modified: 08-06-2022, 06:09 AM by Davider.)
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?
The current code:
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
Posts: 12,073
Threads: 140
Joined: Dec 2002
Function Middle_Click_FF
Trigger #M //Middle_Click_FF
;/
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
Posts: 1,031
Threads: 246
Joined: Jul 2022
Thanks for your help, Works well now!
|