Sign in to follow this  
Followers 0
jonny1234

Disable context menu key (APPSKEY)

10 posts in this topic

Hi,

Please could you tell me how to disable the context menu key (APPSKEY). I have tried setting it as a hotkey using:

HotKeySet("{APPSKEY}", "KeyPressedApps")

The KeyPressedApps function detects the apps key down event, but the context menu is still displayed when the apps key is released. Is there a way to intercept this?

Thanks for your help.

Regards,

Jonny

Share this post


Link to post
Share on other sites



Hi, you cannot set hotkeys to the winkey - please refer to the help file before asking!

Cheers,

Sunaj

Btw; you could have a look at a derivative of AutoIt; http://www.autohotkey.com/docs/Hotkeys.htm - but this should not be discussed any further on this forum since it pertains to different software product than AutoIt.

Hi,

Please could you tell me how to disable the context menu key (APPSKEY). I have tried setting it as a hotkey using:

HotKeySet("{APPSKEY}", "KeyPressedApps")

The KeyPressedApps function detects the apps key down event, but the context menu is still displayed when the apps key is released. Is there a way to intercept this?

Thanks for your help.

Regards,

Jonny

Share this post


Link to post
Share on other sites

Hi, you cannot set hotkeys to the winkey - please refer to the help file before asking!

Thanks for the interesting aside and advice. I'll keep them both in mind. Now back to the question of disabling the APPSKEY (which is not the Win key). Please refer to the first post before answering.

Regards,

Jonny

Share this post


Link to post
Share on other sites

Heheh, sorry for that one - my bad, I looked through the helpfile too quickly myself :P - Anyway, think I may have an idea for you: it seems that Shift + F10 controls the same feature as the APPSKEY.. and you can definately set a hotkey on Shift + F10 that intercepts the context menu which would otherwise have been called forth:

HotKeySet("+{F10}", "KeyPressedApps")

That's about all I can offer on this one as I don't have a APPSKEY on my laptop.

Thanks for the interesting aside and advice. I'll keep them both in mind. Now back to the question of disabling the APPSKEY (which is not the Win key). Please refer to the first post before answering.

Share this post


Link to post
Share on other sites

Heheh, sorry for that one - my bad, I looked through the helpfile too quickly myself :P - Anyway, think I may have an idea for you: it seems that Shift + F10 controls the same feature as the APPSKEY.. and you can definately set a hotkey on Shift + F10 that intercepts the context menu which would otherwise have been called forth:

HotKeySet("+{F10}", "KeyPressedApps")

That's about all I can offer on this one as I don't have a APPSKEY on my laptop.

Thanks for trying to help Sunaj. Your solution does prevent the context menu from being displayed when Shift+F10 is pressed. But when I change "+{F10}" to "{APPSKEY}" and press the APPSKEY, the context menu still appears.

I don't see a solution to this other than updating the help file to say that the APPSKEY press will always be forwarded to the active application.

Unless anyone else has any ideas?

Regards,

Jonny

Share this post


Link to post
Share on other sites

Thanks for trying to help Sunaj. Your solution does prevent the context menu from being displayed when Shift+F10 is pressed. But when I change "+{F10}" to "{APPSKEY}" and press the APPSKEY, the context menu still appears.

I don't see a solution to this other than updating the help file to say that the APPSKEY press will always be forwarded to the active application.

Unless anyone else has any ideas?

Regards,

Jonny

Just to make this clear to me, do you mean that setting a hotkey for "+{F10}" stops Shift+F10, but doesn't stop the APPSKEY? I would be interested to know because I don't have an APPSKEY and I believed it was identical to pressing shift+F10.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Small hack :P :

;
; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/resources/menus/menureference/menumessages/wm_contextmenu.asp
;
; "...DefWindowProc generates the WM_CONTEXTMENU message when it processes the WM_RBUTTONUP or WM_NCRBUTTONUP message
; or when the user types SHIFT+F10.
; The WM_CONTEXTMENU message is also generated when the user presses and releases the VK_APPS key.
; If the context menu is generated from the keyboard - for example, if the user types SHIFT+F10 - 
; then the x- and y-coordinates are -1"
;


#include <GUIConstants.au3>

Global Const $WM_CONTEXTMENU = 0x007B

GUIRegisterMsg($WM_CONTEXTMENU, "WndProc")

$hGUI = GUICreate("Test")
$context = GUICtrlCreateContextMenu(-1)
$item1 = GUICtrlCreateMenuItem("Item1", $context)
$item2 = GUICtrlCreateMenuItem("Item2", $context)

GUISetState()

Do
    $Msg = GUIGetMsg()
Until $Msg = $GUI_EVENT_CLOSE

Exit

Func WndProc($hWnd, $Msg, $wParam, $lParam)
    If $Msg = $WM_CONTEXTMENU And $lParam = -1 Then
        ConsoleWrite("Appskey was pressed" & @LF)
        Return 0    
    EndIf
EndFunc

Greets

Holger

Edited by Holger

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Just to make this clear to me, do you mean that setting a hotkey for "+{F10}" stops Shift+F10, but doesn't stop the APPSKEY?

Yes, that's what I mean.

Regards,

Jonny

Edited by jonny1234

Share this post


Link to post
Share on other sites

Thanks for your reply, Holger.

I have modified your code by adding an input control. You will see that it is possible to use the right mouse button and the apps key on the input control. I don't want the context menu to be displayed at all for the input control (or for any other control on my form), either by using the mouse or by using the apps key.

#include <GUIConstants.au3>

Global Const $WM_CONTEXTMENU = 0x007B

GUIRegisterMsg($WM_CONTEXTMENU, "WndProc")

$hGUI = GUICreate("Test")
$context = GUICtrlCreateContextMenu(-1)
$item1 = GUICtrlCreateMenuItem("Item1", $context)
$item2 = GUICtrlCreateMenuItem("Item2", $context)
$inpTest = GUICtrlCreateInput("", 50, 50, 300, 20)
GUICtrlSetData($inpTest, "You can right-click or press APPS key here")


GUISetState()

Do
    $Msg = GUIGetMsg()
Until $Msg = $GUI_EVENT_CLOSE

Exit

Func WndProc($hWnd, $Msg, $wParam, $lParam)
    If $Msg = $WM_CONTEXTMENU And $lParam = -1 Then
        ConsoleWrite("Appskey was pressed" & @LF)
        Return 0    
    EndIf
EndFunc

Regards,

Jonny

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

There is no solution at the moment I think cause you cannot 'subclass' a control - you cannot receive the _window_ - messages from the control window itself (like i.e. WM_Contextmenu).

Edited by Holger

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0