View --> Color box (in Paint, WinXP)
What should I change to use it in other menus, submenus, or windows if possible ???
Code: Select all
#persistent
SetTitleMatchMode, 2
Loop
{ Sleep, 500
if WinActive("ahk_class MSPaintApp")
WhatWin := "MSPaintApp", WhatSubmenu := "Tools", #Sub := "2"
Else if WinActive("ahk_class Notepad")
WhatWin :="Notepad", WhatSubmenu :="Status Bar", #Sub := "3"
win_hwnd := WinExist("ahk_class " WhatWin ) ; <<< WINDOW
if(win_hwnd = "0x0")
{ tooltip, Please activate Notepad OR Paint.
continue
}
main_Menu := DllCall("GetMenu", UInt, win_hwnd) ; <<< MENUBAR
view_menu := DllCall("GetSubMenu", UInt, main_Menu, Int, #Sub) ; <<< SUBMENU
SendMessage , 0x116, view_menu, 0,, ahk_id %win_hwnd% ; <<< NOTEPAD . WM_INITMENU
SendMessage , 0x0117, view_menu, 0,, ahk_id %win_hwnd% ; <<< MSPAINT . WM_INITMENUPOPUP "Sent when a drop-down menu or submenu is about to become active"
if DllCall("GetMenuState", UInt, view_menu, UInt, 0, UInt, 0x400) >> 2 & 2 ; 2 & 2 2 & 3 = PAINT:tools. 3 & 1 = NOTEPAD:statusbar
tooltip, %WhatWin% '%WhatSubmenu%' menu is checked ☻
else tooltip, %WhatWin% '%WhatSubmenu%' menu is UNchecked ☺
; "sometimes a window menu should be refrashed with WM_ENTERMENULOOP, WM_EXITMENULOOP."
}
Return