Please enable JavaScript to view this site.

A-Shell Reference

cmd (String, in) should be set to the command, DLL, keystrokes, object, or internal ID, according to the mtype. It is ignored for the submenu (MBF_SUBMNU) and separator (MNU_SEP) menu item types.

Care should be taken so that your custom menu commands remain contextually compatible with the application.  For example, creating a menu item labeled "Help" with cmd = "?" + chr(13) might make sense in the context of a screen or menu which understands that keyboard sequence, but may make no sense in a text editing context where those would simply be ordinary characters. Any of the following strategies might be employed to avoid the problem:

Use menu types MBF_SHLEXC and MBF_CMDLIN, since they launch external windows without affecting the current application context.
Disable or delete the menu items when switching to an application context where they no longer apply. This is usually a error prone and tedious to program and thus not highly recommended.
For MBF_KBD menus, use universal control characters (that may be applicable everywhere, such as VK_ESC), or pseudo-function keys which are either context-independent or can be ignored by applications that don't recognize them. In either case, use Virtual Key Symbolic Names whenever possible, to avoid complications with the handling of literal control characters. (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 Carriage-Return (Ctrl+M).

Examples

mtype = MBF_KBD     : cmd = "VK_xF213"    ! virtual function key 213

mtype = MBF_KBD     : cmd = "^C"          ! Control C (using "^" notation)

mtype = MBF_CMDLIN  : cmd = "CALC.EXE"    ! launch calculator

mtype = MBF_SHLEXC  : cmd = "www.me.com"  ! launch browser