Document

Header snippet

Win32 desktop application API to enumerate all menu items with id from another GUI window

Usage

Think about if you have ten millions of menus, submenus.

Source code

https://github.com/snowman/scripts/tree/master/print-win32-program-menus

Run

cmd> g++ main.cpp
cmd> a.exe
hWnd: 266060

hmenuMain: 310841463
menu: &File
  id, name:     1, &New Ctrl+N
  id, name:     8, New &Window  Ctrl+Shift+N
  id, name:     2, &Open...     Ctrl+O
  id, name:     3, &Save        Ctrl+S
  id, name:     4, Save &As...  Ctrl+Shift+S
  id, name:     0,
  id, name:     5, Page Set&up...
  id, name:     6, &Print...    Ctrl+P
  id, name:     0,
  id, name:     7, E&xit
menu: &Edit
  id, name:    16, &Undo        Ctrl+Z
  id, name:     0,
  id, name:   768, Cu&t Ctrl+X
  id, name:   769, &Copy        Ctrl+C
  id, name:   770, &Paste       Ctrl+V
  id, name:   771, De&lete      Del
  id, name:     0,
  id, name:    28, &Search with Bing... Ctrl+E
  id, name:    21, &Find...     Ctrl+F
  id, name:    22, Find &Next   F3
  id, name:    29, Find Pre&vious       Shift+F3
  id, name:    23, &Replace...  Ctrl+H
  id, name:    24, &Go To...    Ctrl+G
  id, name:     0,
  id, name:    25, Select &All  Ctrl+A
  id, name:    26, Time/&Date   F5
menu: F&ormat
  id, name:    32, &Word Wrap
  id, name:    33, &Font...
menu: &View
  menu: &Zoom
  id, name:    27, &Status Bar
menu: &Help
  id, name:    64, View &Help
  id, name:    66, Send &Feedback
  id, name:     0,
  id, name:    65, &About Notepad
cmd> a.exe | findstr /I about
  id, name:    65, &About Notepad

TODO

- Add support to enumerate nested sub-submenu item
  File menu
    Align submenu
      Align to left sub-submenu item
      Align to right sub-submenu item
      ...
posted @ 2020-03-26 14:58  codworm  阅读(92)  评论(0编辑  收藏  举报
Document

Footer snippet