cmd (string, in) should be set to the command, DLL, keystrokes, or object, according to the type. It is ignored for the submenu (MBF_SUBMNU) and separator (MNU_SEP) menu item types.
The most convenient approach for handling menu options as keyboard commands is often to make them emulate INFLD function keys (thus allowing the menu selections to interrupt existing input operations while still allowing your code to respond differently depending on the context.) To emulate a function key, set cmd to a string consisting of a Ctrl+G (ASCII 7) followed by “1” through “9” for F1 through F9, or “A” through “Z” for F10 through F35. ASCII characters higher than “Z” will result in correspondingly higher function key values. Or, preferably, use the Virtual Key Symbolic Name, e.g. VK_xF###.
Encoding control characters in the cmd as described above is somewhat awkward at best and makes it impossible to store them in a parameter file, as is the case with the simplified method (described below). As an alternative, you can also encode them using the ^X notation, (where ^X is interpreted as Ctrl+X, for any character A-Z or [, ], \, underline, or another caret). Thus the cmd string “^GA” would be treated as Ctrl+G followed by the letter A, and “Hello^M” would be treated as the word “Hello” followed by a CarriageReturn (Ctrl+M).