Jump to content

explorer's context menu


Deye
 Share

Recommended Posts

To all,

I was looking for the command that can launch explorer's context menu
With most of searches so far results that "tell how to add items to it"  I'm only trying to load it in whole ..

If anyone here knows the know how, I'm still interested to know !

I will continue try with more wording combo's in my searches, later on ..

Thanks
Deye

Link to comment
Share on other sites

This appears to work for me:

ControlClick("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]", 'right')

I should add that this was tested on a Windows 7 OS.  Haven't tried it on Windows 10.

Updated:

Please disregard my post.  I think Shift+F10, with ControlSend, is much more reliable than a right mouse click.  ;)

Edited by TheXman
Link to comment
Share on other sites

It will also need to accept a FilePath to address 

ie:  ControlSend("Program Manager", "", "[CLASS:SysListView32; INSTANCE:1]", @ScriptFullPath)

for instance http://www.easexp.com/xsearch/ this one doesn't offer explorer's one but still gives the option to "open with" (even though for just one file)
all so that the file argument  passes  "Open With" > "My App context menu wrapper" > options to some winrar command  that is available in the explorer context menu ..

found these 2 links so far, still not fully readable to me ..

https://www.codeproject.com/Articles/22012/%2fArticles%2f22012%2fExplorer-Shell-Context-Menu

https://blogs.msdn.microsoft.com/oldnewthing/20040920-00/?p=37823

Deye

Edited by Deye
Link to comment
Share on other sites

Link to comment
Share on other sites

Thanks LarsJ,

Yet to figure-out how its to be executed ,will read into it ..

@ first try .. :sweating: 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include "ShellContextMenu.au3"
#include <Misc.au3>

HotKeySet("{ESC}", "Close") ; Set ESC as a hotkey to exit the script.

Global $g_tStruct = DllStructCreate($tagPOINT) ; Create a structure that defines the point to be checked.
Global $hDLL = DllOpen("user32.dll")

Example()

Func Example()
    Local $hWnd
    While 1
        ToolTip("")
        Position() ; Update the X and Y elements with the X and Y co-ordinates of the mouse.
        $hWnd = _WinAPI_WindowFromPoint($g_tStruct) ; Retrieve the window handle.
        If _IsPressed("01", $hDLL) Then
            ShellContextMenu($hWnd, $hWnd, $g_tStruct, @ScriptFullPath)
            Sleep(5000)
            ExitLoop
        EndIf
        ToolTip("left click somewhere ..")
        Sleep(100)
    WEnd
    DllClose($hDLL)
EndFunc   ;==>Example

Func Position()
    DllStructSetData($g_tStruct, "x", MouseGetPos(0))
    DllStructSetData($g_tStruct, "y", MouseGetPos(1))
EndFunc   ;==>Position

Func Close()
    DllClose($hDLL)
    Exit
EndFunc   ;==>Close

Deye

Link to comment
Share on other sites

Deye, You can start with this code:

#AutoIt3Wrapper_UseX64=y

#include "ShellContextMenu.au3"

HotKeySet( "{F1}", "CMenu" ) ; F1: Open context menu, Esc: Close context menu
HotKeySet( "{F2}", "Close" ) ; F2: Close script

While Sleep(10)
WEnd

Func CMenu()
  Local $hDesktop = _WinAPI_GetDesktopWindow()
  Local $tPoint = _WinAPI_GetMousePos(), $x = DllStructGetData( $tPoint, "x" ), $y = DllStructGetData( $tPoint, "y" )
  Local $hGui = GUICreate( "", 32, 32, $x, $y, 0x80880000 ) ; 0x80880000 = $WS_POPUPWINDOW
  GUISetState( @SW_SHOW, $hGui ) ; You must create a GUI
  ShellContextMenu( $hGui, $hDesktop, $tPoint, @ScriptFullPath )
  GUIDelete( $hGui )
EndFunc

Func Close()
  Exit
EndFunc

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...