Jump to content

How to check the taskbar context menu


Recommended Posts

Hi,

When you rightclick the taskbar, a context menu opens. Pointing to the first entry opens a submenu which shows all bars implemented and their status (activated or deactivated).

WinActivate("classname=Shell_TrayWnd")
Send("{SHIFTDOWN}{F10}{SHIFTUP}")
Send("{DOWN}{RIGHT}")

brings up the submenu. But how do I get the bars' names and their status? (I want to check/uncheck certain bars depending on the hardware profile Windows has been started with.)

Many thanks for any help.

mumdigau

Link to comment
Share on other sites

I tried a bit on my own. That is where I am at the moment:

#include <GuiMenu.au3>
;;;
Opt("TrayIconDebug", 1)
Opt("WinTitleMatchMode", 2)
Opt("MustDeclareVars", 1)
;;;
Dim $hTDSL
Dim $iBars
Dim $hWin
Dim $iMenuItems
Dim $hMenu
Dim $iBarsItems
Dim $hTDSL
Dim $sItemText
Dim $iStatusBar
Dim $iStatusBarStatus 
Dim $i
;;;
Dim Const $menu_text    = "Symbolleisten"
Dim Const $submenu_text = "T-DSL SpeedManager"
;;;
$hWin = WinGetHandle("[CLASS:Shell_TrayWnd]")
$hMenu = _GUICtrlMenu_GetMenu($hWin)
$iMenuItems = _GUICtrlMenu_GetItemCount($hMenu)
$iBars = -1
For $i = 0 To $iMenuItems - 1
      $sItemText = _GUICtrlMenu_GetItemText($hMenu, $i, True)
      If StringInStr($sItemText, $menu_text) Then
          $iBars = $i
      EndIf
Next
$hTDSL = _GUICtrlMenu_GetItemSubMenu($hMenu, $iBars)
$iBarsItems = _GUICtrlMenu_GetItemCount($hTDSL)
For $i = 0 To $iBarsItems - 1
      $sItemText = _GUICtrlMenu_GetItemText($hTDSL, $i, True)
      If StringInStr($sItemText, $submenu_text) Then
          $iStatusBar = $i
      EndIf
Next
$iStatusBarStatus = _GUICtrlMenu_GetItemState($hTDSL, $iStatusBar, True)

The handle to the taskbar seems to work, but I can't get the handle to the menu. Return Code is always 0 (i. e. failure).

Missing/wrong #include? Any other idea?

Thanks

mumdigau

Edited by mumdigau
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...