How to mask the Windows Key while click Menu?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
zhanglei1371
Posts: 28
Joined: 05 Aug 2014, 02:01

How to mask the Windows Key while click Menu?

19 Sep 2022, 05:05

Hi everyone,I met a puzzle about the Windows key.
What I have done was this :
I used the hotkey #4 to create a menu.
While the menu appears,then I pressed the "Lwin" and Click the menu,Now I can get three different actions though one Menu.

Code: Select all

#SingleInstance,force

#4::
Menu, MySubmenu, Add, Item1
Menu, MySubmenu,show
return


Item1:
if getkeystate("Lwin")
	MsgBox you press Lwin!But the window's Menu will be activated!
else if getkeystate("Rwin")
	MsgBox you press Rwin!But the window's Menu will be activated!
return
But the puzzle is the windows Menu will appear after I click the Ahk's menu.
What I want is how to mask the windows Menu while I click the ahk's Menu?
And At the same time ,The Lwin and Rwin's function is normal without interupt?
Thanks very much for the help!
User avatar
mikeyww
Posts: 27214
Joined: 09 Sep 2014, 18:38

Re: How to mask the Windows Key while click Menu?

25 Sep 2022, 06:24

Code: Select all

Menu, select, Add, Item1

#4::
on := True
Menu, select, Show
#If on
LWin::
RWin::Return
#If

Item1:
Switch {
 Case GetKeyState("LWin", "P"): MsgBox you press Lwin!But the window's Menu will be activated!
 Case GetKeyState("RWin", "P"): MsgBox you press Rwin!But the window's Menu will be activated!
 Default: MsgBox, Test
}
KeyWait, LWin
KeyWait, RWin
on := False
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo, Chunjee and 139 guests