Export (0) Print
Expand All

ACCELERATORS resource

Defines one or more accelerators for an application. An accelerator is a keystroke defined by the application to give the user a quick way to perform a task.

acctablename ACCELERATORS [optional-statements] {event, idvalue, [type] [options]... }

Parameters

acctablename

Unique name or a 16-bit unsigned integer value that identifies the resource.

optional-statements

Zero or more of the following statements.

StatementDescription
CHARACTERISTICS dwordUser-defined information about a resource that can be used by tools that read and write resource files. For more information, see CHARACTERISTICS.
LANGUAGE language, sublanguageSpecifies the language for the resource. For more information, see LANGUAGE.
VERSION dwordUser-defined version number for the resource that can be used by tools that read and write resource files. For more information, see VERSION.

 

event

Keystroke to be used as an accelerator. It can be any one of the following character types.

TypeDescription
"char"A single character enclosed in double quotation marks ("). The character can be preceded by a caret (^), meaning that the character is a control character.
CharacterAn integer value representing a character. The type parameter must be ASCII.
virtual-key characterAn integer value representing a virtual key. The virtual key for alphanumeric keys can be specified by placing the uppercase letter or number in double quotation marks (for example, "9" or "C"). The type parameter must be VIRTKEY.

 

idvalue

a 16-bit unsigned integer value that identifies the accelerator.

type

Required only when the event parameter is a character or a virtual-key character. The type parameter specifies either ASCII or VIRTKEY; the integer value of event is interpreted accordingly. When VIRTKEY is specified and event contains a string, event must be uppercase.

options

options that define the accelerator. This parameter can be one or more of the following values.

OptionDescription
NOINVERTSpecifies that no top-level menu item is highlighted when the accelerator is used. This is useful when defining accelerators for actions such as scrolling that do not correspond to a menu item. If NOINVERT is omitted, a top-level menu item will be highlighted (if possible) when the accelerator is used. This attribute is obsolete and retained only for backward compatibility with resource files designed for 16-bit Windows.
ALTCauses the accelerator to be activated only if the ALT key is down. Applies only to virtual keys.
SHIFTCauses the accelerator to be activated only if the SHIFT key is down. Applies only to virtual keys
CONTROL Defines the character as a control character (the accelerator is only activated if the CONTROL key is down). This has the same effect as using a caret (^) before the accelerator character in the event parameter. Applies only to virtual keys

 

Certain attributes are also supported for backward compatibility. For more information, see Common Resource Attributes.

Remarks

The TranslateAccelerator function is used to translate accelerator messages from the application queue into WM_COMMAND or WM_SYSCOMMAND messages.

Examples

The following example demonstrates the use of accelerator keys.

1 ACCELERATORS
{
  "^C",  IDDCLEAR         ; control C
  "K",   IDDCLEAR         ; shift K
  "k",   IDDELLIPSE, ALT  ; alt k
  98,    IDDRECT, ASCII   ; b
  66,    IDDSTAR, ASCII   ; B (shift b)
  "g",   IDDRECT          ; g
  "G",   IDDSTAR          ; G (shift G)
  VK_F1, IDDCLEAR, VIRTKEY                ; F1
  VK_F1, IDDSTAR, CONTROL, VIRTKEY        ; control F1
  VK_F1, IDDELLIPSE, SHIFT, VIRTKEY       ; shift F1
  VK_F1, IDDRECT, ALT, VIRTKEY            ; alt F1
  VK_F2, IDDCLEAR, ALT, SHIFT, VIRTKEY    ; alt shift F2
  VK_F2, IDDSTAR, CONTROL, SHIFT, VIRTKEY ; ctrl shift F2
  VK_F2, IDDRECT, ALT, CONTROL, VIRTKEY   ; alt control F2
}

See also

Using Keyboard Accelerators
TranslateAccelerator
CHARACTERISTICS
DIALOG
LANGUAGE
MENU
RCDATA
STRINGTABLE
VERSION

 

 

Community Additions

ADD
Show:
© 2014 Microsoft