Jump to content

Show desktop context menu


gmh2000
 Share

Recommended Posts

The following code doesn't work because of the context menu which appears is the context menu of the first file on the desktop instead the context menu when you click on a empty space of it.

WinActivate("Program Manager")
Send("{APPSKEY}")
Opt("WinWaitDelay", 100)
SEND("O") ; O is the first letter of "Opciones Gráficas"
SEND("S") ; S is the first letter of "Salida para"
SEND("P") ; T is the first letter of "Portátil"

Any idea? Thanks in advance!

Link to comment
Share on other sites

For me it works with the context menu of the desktop?!

Maybe you could try with WinMinimizeAll and MouseClick.

Edit: Now I figured out your problem. Here is the solution:

#Include <GuiListView.au3>
$hLV = ControlGetHandle('Program Manager', '', 'SysListView321')
_GUICtrlListView_SetItemSelected($hLV, -1, 0)

WinActivate("Program Manager")
Send("{APPSKEY}")

;~ Opt("WinWaitDelay", 100)
;~ SEND("O") ; O is the first letter of "Opciones Gráficas"
;~ SEND("S") ; S is the first letter of "Salida para"
;~ SEND("P") ; T is the first letter of "Portátil"
Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

#include <GUIListView.au3>

Global Const $WM_RBUTTONDOWN = 0x0204
Global Const $WM_RBUTTONUP = 0x0205

Local $hWnd = WinGetHandle("Program Manager")
Local $hLV = ControlGetHandle($hWnd, "", "SysListView321")

Local $aHitTest

For $i = 0 To @DesktopWidth Step @DesktopWidth/4
    $aHitTest = _GUICtrlListView_HitTest($hLV, $i, @DesktopHeight/2)
    
    If $aHitTest[0] < 0 Then
        _WinAPI_PostMessage($hLV, $WM_RBUTTONDOWN, 2, BitOR(BitShift(@DesktopHeight/2, -16), $i))
        _WinAPI_PostMessage($hLV, $WM_RBUTTONUP, 2, BitOR(BitShift(@DesktopHeight/2, -16), $i))
        ExitLoop
    EndIf
Next

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...