You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An accelerator table is a C++ Windows resource that contains a list of accelerator keys (also known as shortcut keys) and the command identifiers that are associated with them. A program can have more than one accelerator table.
10
+
An accelerator table is a C++ Windows resource that contains a list of accelerator keys, known as shortcut keys, and the command identifiers that are associated with them. A program can have more than one accelerator table.
11
11
12
12
Normally, accelerators are used as keyboard shortcuts for program commands that are also available on a menu or toolbar. However, you can use the accelerator table to define key combinations for commands that don't have a user-interface object associated with them.
13
13
14
-
You can use [Class View](/visualstudio/ide/viewing-the-structure-of-code) to hook accelerator key commands to code.
15
-
16
-
For a list of pre-defined accelerator keys, see [Accelerator Keys](../windows/predefined-accelerator-keys.md).
17
-
18
14
> [!TIP]
19
15
> When using the **Accelerator Editor**, right-click to display a shortcut menu of frequent commands. The commands available depend on what the pointer is pointing to.
20
16
17
+
You can use [Class View](/visualstudio/ide/viewing-the-structure-of-code) to hook accelerator key commands to code. For a list of pre-defined accelerator keys, see [Accelerator Keys](../windows/predefined-accelerator-keys.md).
18
+
21
19
> [!NOTE]
22
20
> Windows doesn't allow you to create empty accelerator tables. If you create an accelerator table with no entries, it is deleted automatically when you save the table.
23
21
24
22
## Accelerator Properties
25
23
26
24
You can set accelerator properties in the [Properties window](/visualstudio/ide/reference/properties-window) at any time. You can also use the **Accelerator Editor** to modify the accelerator properties in the accelerator table. Changes made using the **Properties** window or the **Accelerator Editor** have the same result, edits are immediately reflected in the accelerator table.
27
25
28
-
### ID Property
29
-
30
-
The **ID** property references each accelerator table entry in program code. This entry is the command value that the program receives when a user presses the accelerator key or a key combination. To make an accelerator the same as a menu item, make their **ID** the same, so long as the **ID** of the accelerator table is the same as the **ID** for the menu resource.
26
+
The **ID** property references each accelerator table entry in program code. This entry is the command value that the program receives when a user presses the accelerator key or a key combination. To make an accelerator the same as a menu item, make the **ID** the same, so long as the **ID** of the accelerator table is the same as the **ID** for the menu resource.
31
27
32
-
There are three properties for each accelerator **ID**: **Modifier**, **Key**, and **Type**
33
-
34
-
#### Modifier Property
28
+
Each accelerator **ID** has three properties: **Modifier**, **Key**, and **Type**
35
29
36
30
The **Modifier** property sets control key combinations for the accelerator.
37
31
@@ -42,16 +36,14 @@ The following are legal entries for the **Modifier** property in the accelerator
42
36
43
37
|Value|Description|
44
38
|-----------|-----------------|
45
-
|**None**|User presses only the **Key** value.This value is most effectively used with the ASCII/ANSI values 001 through 026, which is interpreted as ^A through ^Z (**Ctrl+A** through **Ctrl+Z**).|
39
+
|**None**|User presses only the **Key** value.<br/><br/>This value is most effectively used with the ASCII/ANSI values 001 through 026, which is interpreted as ^A through ^Z (**Ctrl+A** through **Ctrl+Z**).|
46
40
|**Alt**|User must press **Alt** before the **Key** value.|
47
-
|**Ctrl**|User must press **Ctrl** before the **Key** value. Not valid with ASCII Type.|
41
+
|**Ctrl**|User must press **Ctrl** before the **Key** value, not valid with ASCII Type.|
48
42
|**Shift**|User must press **Shift** before the **Key** value.|
49
-
|**Ctrl+Alt**|User must press **Ctrl** and **Alt** before the **Key** value. Not valid with ASCII Type.|
50
-
|**Ctrl+Shift**|User must press **Ctrl** and **Shift** before the **Key** value. Not valid with ASCII Type.|
51
-
|**Alt+Shift**|User must press **Alt** and **Shift** before the **Key** value. Not valid with ASCII Type.|
52
-
|**Ctrl+Alt+Shift**|User must press **Ctrl**, **Alt**, and **Shift** before the **Key** value. Not valid with ASCII Type.|
53
-
54
-
#### Key Property
43
+
|**Ctrl+Alt**|User must press **Ctrl** and **Alt** before the **Key** value, not valid with ASCII Type.|
44
+
|**Ctrl+Shift**|User must press **Ctrl** and **Shift** before the **Key** value, not valid with ASCII Type.|
45
+
|**Alt+Shift**|User must press **Alt** and **Shift** before the **Key** value, not valid with ASCII Type.|
46
+
|**Ctrl+Alt+Shift**|User must press **Ctrl**, **Alt**, and **Shift** before the **Key** value, not valid with ASCII Type.|
55
47
56
48
The **Key** property sets the actual key to use as the accelerator.
57
49
@@ -61,37 +53,35 @@ The following are legal entries for the **Key** property in the accelerator tabl
61
53
|-----------|-----------------|
62
54
|An integer between 0 and 255 in decimal format.|The value determines whether the value is treated as ASCII or ANSI as follows:<br/><br/> - Single-digit numbers are always interpreted as the corresponding key, rather than as ASCII or ANSI values.<br/> - Values from 1 through 26, when preceded with zeros, are interpreted as ^A through ^Z, which represents the ASCII value of the letters of the alphabet when pressed with the **Ctrl** key held down.<br/> - Values from 27-32 are always interpreted as three-digit decimal values 027 through 032.<br/> - Values from 033 through 255, whether preceded by 0's or not are interpreted as ANSI values.|
63
55
|A single keyboard character.|Uppercase A - Z or the numbers 0 - 9 can be either ASCII or virtual key values. Any other character is ASCII only.|
64
-
|A single keyboard character in the range A - Z (uppercase only), preceded by a caret (^).<br/><br/>For example, ^C.|This option enters the ASCII value of the key when it's pressed with the **Ctrl** key held down.|
56
+
|A single keyboard character in the range A - Z (uppercase only), preceded by a caret (^), for example, ^C.|This option enters the ASCII value of the key when it's pressed with the **Ctrl** key held down.|
65
57
|Any valid virtual key identifier.|The drop-down **Key** box in the accelerator table contains a list of standard virtual key identifiers.|
66
58
67
59
> [!NOTE]
68
60
> When entering an ASCII value, the **Modifier** property options are limited. The only control key available for use is the **Alt** key.
69
61
70
62
> [!TIP]
71
-
> A shortcut to define an accelerator key is to right-click an entry or multiple entries in the accelerator table. Choose **Next Key Typed** and then press any of the keys or key combinations on the keyboard.
63
+
> A shortcut to define an accelerator key is to right-click an entry or multiple entries in the accelerator table, then choose **Next Key Typed** and press any of the keys or key combinations on the keyboard.
72
64
>
73
-
> The **Next Key Typed** command is also available from the **Edit** menu.
74
-
75
-
#### Type Property
65
+
> This **Next Key Typed** command is also available from the **Edit** menu.
76
66
77
67
The **Type** property determines whether the shortcut key combination associated with the accelerator **ID** is interpreted as an ASCII/ANSI key value or a virtual key (VIRTKEY) combination.
78
68
79
-
- If the **Type** property is **ASCII**, the **Modifier** property may only be `None` or `Alt`, or it can have an accelerator that uses the **Ctrl** key (specified by preceding the key with a `^`).
69
+
- If the **Type** property is **ASCII**, the **Modifier** property may only be `None` or `Alt`, or it can have an accelerator that uses the **Ctrl** key, as specified by preceding the key with a `^`.
80
70
81
71
- If the **Type** property is **VIRTKEY**, any combination of **Modifier** and **Key** values is valid.
82
72
83
73
> [!NOTE]
84
-
> If you want to enter a value into the accelerator table and have the value treated as ASCII/ANSI, select the **Type** for the entry in the table and select **ASCII** from the drop down list. However, if you use the **Next Key Typed** command from the **Edit** menu to specify the **Key**, you must change the **Type** property from **VIRTKEY** to **ASCII***before* entering the **Key** code.
74
+
> If you want to enter a value into the accelerator table and have the value treated as ASCII/ANSI, select the **Type** for the entry in the table and select **ASCII** from the dropdown list. However, if you use the **Next Key Typed** command from the **Edit** menu to specify the **Key**, you must change the **Type** property from **VIRTKEY** to **ASCII***before* entering the **Key** code.
85
75
86
76
## Accelerator Tables
87
77
88
78
In a C++ project, you can edit an accelerator table directly with in-place editing in the **Accelerator Editor**.
89
79
90
80
The procedures below refer to the use of standard property pages, however, both in-place editing and the property page method have the same result. Changes made using property pages or using in-place editing are immediately reflected in the accelerator table.
91
81
92
-
To edit in an accelerator table:
82
+
### To edit in an accelerator table
93
83
94
-
1. Open the accelerator table by double-clicking its icon in [Resource View](../windows/resource-view-window.md).
84
+
1. Open the accelerator table by double-clicking its icon in [Resource View](/windows/how-to-create-a-resource-script-file#create-resources).
95
85
96
86
1. Select an entry in the table and select to activate in-place editing.
97
87
@@ -105,41 +95,41 @@ To edit in an accelerator table:
105
95
106
96
- For **Type**, select **ASCII** or **VIRTKEY** from the list.
107
97
108
-
To find an entry in an open accelerator table:
98
+
### To find an entry in an open accelerator table
109
99
110
-
1. Open the accelerator table by double-clicking its icon in [Resource View](../windows/resource-view-window.md).
100
+
1. Open the accelerator table by double-clicking its icon in [Resource View](/windows/how-to-create-a-resource-script-file#create-resources).
111
101
112
102
1. Select a column head to sort the contents of the column alphabetically. For example, select **ID** to display all the IDs in your accelerator table alphabetically.
113
103
114
104
You can then scan the list and find the entry.
115
105
116
-
To add an entry to an accelerator table:
106
+
### To add an entry to an accelerator table
117
107
118
-
1. Open the accelerator table by double-clicking its icon in [Resource View](../windows/resource-view-window.md).
108
+
1. Open the accelerator table by double-clicking its icon in [Resource View](/windows/how-to-create-a-resource-script-file#create-resources).
119
109
120
-
1. Right-click within the accelerator table and choose **New Accelerator** from the shortcut menu, or select the empty row entry at the bottom of the table.
110
+
1. Right-click within the accelerator table and choose **New Accelerator**, or select the empty row entry at the bottom of the table.
121
111
122
112
1. Select an **ID** from the drop-down list in the **ID** box or type a new *ID* in the **ID** box.
123
113
124
-
1. Type the *Key* you want to use as an accelerator, or right-click and choose **Next Key Typed**from the shortcut menu to set a key combination, or go to menu **Edit** > **Next Key Typed**.
114
+
1. Type the *Key* you want to use as an accelerator, or right-click and choose **Next Key Typed** to set a key combination, or go to menu **Edit** > **Next Key Typed**.
125
115
126
116
1. Change the **Modifier** and **Type**, if necessary, and press **Enter**.
127
117
128
-
> [!NOTE]
129
-
> Make sure all accelerators you define are unique. You can have several key combinations assigned to the same ID with no ill effect, for example, **Ctrl**+**P** and **F8** can both be assigned to ID_PRINT. However, having a key combination assigned to more than one ID won't work well, for example, **Ctrl**+**Z** assigned to both ID_SPELL_CHECK and ID_THESAURUS.
118
+
> [!NOTE]
119
+
> Make sure all accelerators you define are unique. You can have several key combinations assigned to the same ID with no ill effect, for example, **Ctrl**+**P** and **F8** can both be assigned to ID_PRINT. However, having a key combination assigned to more than one ID won't work well, for example, **Ctrl**+**Z** assigned to both ID_SPELL_CHECK and ID_THESAURUS.
130
120
131
-
To delete an entry from an accelerator table:
121
+
### To delete an entry from an accelerator table
132
122
133
-
1. Open the accelerator table by double-clicking its icon in [Resource View](../windows/resource-view-window.md).
123
+
1. Open the accelerator table by double-clicking its icon in [Resource View](/windows/how-to-create-a-resource-script-file#create-resources).
134
124
135
125
1. Select the entry you want to delete, or hold down the **Ctrl** or **Shift** key while selecting to choose multiple entries.
136
126
137
127
1. Right-click and choose **Delete**, or go to menu **Edit** > **Delete**.
138
128
139
129
> [!TIP]
140
-
> A shortcut to delete is to press the **Delete** key.
130
+
> You can also press the **Delete** key to delete.
141
131
142
-
To move or copy an accelerator table entry to another resource script file:
132
+
### To move or copy an accelerator table entry to another resource script file
143
133
144
134
1. Open the accelerator tables in both resource script files and select the entry you want to move.
145
135
@@ -150,9 +140,9 @@ To move or copy an accelerator table entry to another resource script file:
150
140
> [!NOTE]
151
141
> You can also use the shortcut keys for copying and pasting.
152
142
153
-
To change the properties of multiple accelerator keys:
143
+
### To change the properties of multiple accelerator keys
154
144
155
-
1. Open the accelerator table by double-clicking its icon in [Resource View](../windows/resource-view-window.md).
145
+
1. Open the accelerator table by double-clicking its icon in [Resource View](/windows/how-to-create-a-resource-script-file#create-resources).
156
146
157
147
1. Select the accelerator keys you want to change by holding down the **Ctrl** key as you select each one.
Below are the accelerator keys for the Image editor commands that are bound to keys by default. To change accelerator keys, click **Options**on the **Tools**menu, and then choose **Keyboard** under the **Environment** folder. For more information, see [Identifying and Customizing Keyboard Shortcuts](/visualstudio/ide/identifying-and-customizing-keyboard-shortcuts-in-visual-studio).
10
+
Below are the accelerator keys for the Image editor commands that are bound to keys by default. To change accelerator keys, go to menu **Tools**> **Options** and choose **Keyboard** under the **Environment** folder. For more information, see [Identifying and Customizing Keyboard Shortcuts](/visualstudio/ide/identifying-and-customizing-keyboard-shortcuts-in-visual-studio).
11
11
12
12
> [!NOTE]
13
-
> The options available in dialog boxes, and the names and locations of menu commands you see, might differ from what is described in Help depending on your active settings or edition. To change your settings, choose **Import and Export Settings** on the **Tools** menu. For more information, see [Personalize the Visual Studio IDE](/visualstudio/ide/personalizing-the-visual-studio-ide).
13
+
> The options available in dialog boxes, and the names and locations of menu commands you see, might differ from what is described in Help depending on your active settings or edition. To change your settings, go to menu **Tools** > **Import and Export Settings**. For more information, see [Personalize the Visual Studio IDE](/visualstudio/ide/personalizing-the-visual-studio-ide).
14
14
15
15
|Command|Keys|Description|
16
16
|-------------|----------|-----------------|
@@ -58,4 +58,8 @@ None
58
58
59
59
## See Also
60
60
61
-
[Image Editor for Icons](../windows/image-editor-for-icons.md)
61
+
[Image Editor for Icons](../windows/image-editor-for-icons.md)<br/>
62
+
[How to: Create an Icon or Other Image](../windows/creating-an-icon-or-other-image-image-editor-for-icons.md)<br/>
63
+
[How to: Edit an Image](../windows/selecting-an-area-of-an-image-image-editor-for-icons.md)<br/>
64
+
[How to: Use a Drawing Tool](../windows/using-a-drawing-tool-image-editor-for-icons.md)<br/>
65
+
[How to: Work with Color](../windows/working-with-color-image-editor-for-icons.md)<br/>
0 commit comments