Sign in to follow this  
Followers 0
gmh2000

Show desktop context menu

5 posts in this topic

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!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Along the same line as Funkey but using keyboard only

activate the desktop window and send shift f10

Edited by picea892

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

OK. Thank you very much!

Edited by gmh2000

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