Prevent shell-context menu from appearing?

Get help with using AutoHotkey and its commands and hotkeys
drawback
Posts: 34
Joined: 11 Aug 2016, 11:31

Prevent shell-context menu from appearing?

03 Oct 2016, 14:53

Hello,

Is it possible to prevent an application (e.g. Windows File Explorer) to show it's shell context menu when an item in it's listview is right-clicked (without doing this in the registry!)?
My script uses a timer (instead of a hotkey) to check which mouse buttons are pressed (and which modifiers as well) and I don't want the shell context menu come up in some cases (atm: on a simple right click with no modifiers)...

Using "Send, {ESC}" is not the way to do that, it just cancels the context menu (immediately) but it doesn't prevent it from being displayed...
User avatar
Capn Odin
Posts: 1308
Joined: 23 Feb 2016, 19:45
Location: Denmark

Re: Prevent shell-context menu from appearing?

03 Oct 2016, 15:17

How about this.

Code: Select all

#If Win_Is("explorer.exe")
	*RButton::return

Win_Is(process){
	MouseGetPos, , , Hwnd
	WinGet, ProcessName, ProcessName, ahk_id %Hwnd%
	return ProcessName = process ? True : False
}
Please excuse my spelling I am dyslexic.
drawback
Posts: 34
Joined: 11 Aug 2016, 11:31

Re: Prevent shell-context menu from appearing?

03 Oct 2016, 15:31

Thank you Capn Odin

Unfortunately this is not about "ignoring" the right click (by immediately returning when it's used). I'm actually doing something inside my timer function when an item is right clicked but I don't want the shell context menu to appear afterwards. Sorry if my explanation was too ambiguous!

Return to “Ask For Help”

Who is online

Users browsing this forum: autohotkeycool, Google [Bot], hasantr, mikeyww, the_body, wineguy and 48 guests