January 1, 2005

WinTask - SysMenuDump

'
' SysMenuDump
'
' Author: Joe Strazzere
'
menustring$="                                                                "

hwnd=GetWindowHandle(top$(),1)
hmenu=External("user32","GetSystemMenu", hwnd, 0)
menucount=External("user32", "GetMenuItemCount", hMenu)
i=o
while i < menucount
  External("user32","GetMenuStringA",hmenu,i,menustring$,64,-1)
 If menustring$ = "" then
    Comment("----- Separator -----")
    else
     Comment(menustring$)
    endif
   hsubmenu=External("user32", "GetSubMenu", hMenu, i)
   submenucount=External("user32", "GetMenuItemCount", hsubMenu)
    j=0
   while j < submenucount
     External("user32","GetMenuStringA",hsubmenu,j,menustring$,64,-1)
     If menustring$ = "" then
      Comment("    ----- Separator -----")
     else
      Comment("    "+menustring$)
     endif
   j=j+1
   wend
i=i+1
wend