newer 发表于 2021-1-12 13:05:01

解决菜单宏中控制符+不能正常使用(Control + letter characters in ActiveX menu ...


问题:

Chr(94) + Chr(80) (^P) is supposed to toggle menuecho, but they are passed to
the command line as literals rather than being interpreted. When I use this, why
does " ^P_Open unknown command" occur?
Answer
There is a character code chart in MSDN that lists the different numeric ASCII
character codes that can be used for the Cntrl + Letter sequences.

The following lists these numeric codes and the associated menu macro syntax:

ASCII Character Codes
;         chr(59) Issues ENTER
^M       chr(13) Issues ENTER
^|      chr(94) + chr(124)       Issues TAB (I did not find any special number
for this)
SPACEBAR      chr(32) Enters a space; blank space between command sequences in
a menu item is equivalent to pressing the SPACEBAR
\         chr(92) Pauses for user input
_          chr(95) Translates AutoCAD commands and key words that follow
+          chr(43) Continues menu macro to the next line (if last character)
=*      chr(61) + chr(42)         Displays the current top-level image, pull-down,
or shortcut menu
*^C^C chr(42) + chr(3) + chr(3)         Prefix for a repeating item
$          chr(36) Loads a menu section or introduces a conditional DIESEL macro
expression
^B      chr(2)   Toggles Snap on or off (CTRL+B)
^C      chr(3)   Cancels command (CTRL+C)
ESC      Chr(3)Cancels command (ESC)
^D       chr(4)   Toggles Coords on or off (CTRL+D)
^E      crh(5)   Sets the next isometric plane (CTRL+E)
^G       chr(7)   Toggles Grid on or off (CTRL+G)
^H       chr(8)   Issues backspace
^O       chr(15) Toggles Ortho on or off (CTRL+O)
^P      chr(16) Toggles MENUECHO on or off
^Q       chr(17) Echoes all prompts, status listings, and input to the printer
(CTRL+Q)
^T      chr(20) Toggles Tablet on or off (CTRL+T)
^V      chr(22) Changes current viewport (CTRL+V)
^Z      chr(26) Null character that suppresses the automatic addition of
SPACEBAR at the end of a menu item
A VBA example that demonstrates creating a Menu Item with Chr(16) in the
menumacro to toggle menuecho off, before setting the system variable PSPROLOG:

下面是VBA源码:
**** Hidden Message *****

页: [1]
查看完整版本: 解决菜单宏中控制符+不能正常使用(Control + letter characters in ActiveX menu ...