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
The first example syntax declares a class to be abstract. The *class-declaration* component can be either a native C++ declaration (**class** or **struct**), or a C++ extension declaration (**ref class** or **ref struct**) if the `/ZW` or `/clr` compiler option is specified.
35
-
36
-
The second example syntax declares a virtual member function to be abstract. Declaring a function abstract is the same as declaring it a pure virtual function. Declaring a member function abstract also causes the enclosing class to be declared abstract.
37
-
38
-
The **abstract** keyword is supported in native and platform-specific code; that is, it can be compiled with or without the `/ZW` or `/clr` compiler option.
39
-
40
-
You can detect at compile time if a type is abstract with the `__is_abstract(type)` type trait. For more information, see [Compiler Support for Type Traits](../windows/compiler-support-for-type-traits-cpp-component-extensions.md).
41
-
42
-
The **abstract** keyword is a context-sensitive override specifier. For more information about context-sensitive keywords, see [Context-Sensitive Keywords](../windows/context-sensitive-keywords-cpp-component-extensions.md). For more information about override specifiers, see [How to: Declare Override Specifiers in Native Compilations](../dotnet/how-to-declare-override-specifiers-in-native-compilations-cpp-cli.md).
43
-
44
-
## Windows Runtime
45
-
For more information, see [Ref classes and structs](../cppcx/ref-classes-and-structs-c-cx.md).
46
-
47
-
### Requirements
48
-
Compiler option: `/ZW`
49
-
50
-
## Common Language Runtime
51
-
52
-
### Requirements
53
-
Compiler option: `/clr`
54
-
55
-
### Examples
56
-
57
-
The following code example generates an error because class `X` is marked **abstract**.
58
-
59
-
```cpp
60
-
// abstract_keyword.cpp
61
-
// compile with: /clr
62
-
ref class X abstract {
63
-
public:
64
-
virtual void f() {}
65
-
};
66
-
67
-
int main() {
68
-
X ^ MyX = gcnew X; // C3622
69
-
}
70
-
```
71
-
72
-
The following code example generates an error because it instantiates a native class that is marked **abstract**. This error will occur with or without the `/clr` compiler option.
73
-
74
-
```cpp
75
-
// abstract_keyword_2.cpp
76
-
classX abstract {
77
-
public:
78
-
virtual void f() {}
79
-
};
80
-
81
-
int main() {
82
-
X * MyX = new X; // C3622: 'X': a class declared as 'abstract'
83
-
// cannot be instantiated. See declaration of 'X'}
84
-
```
85
-
86
-
The following code example generates an error because function `f` includes a definition but is marked **abstract**. The final statement in the example shows that declaring an abstract virtual function is equivalent to declaring a pure virtual function.
87
-
88
-
```cpp
89
-
// abstract_keyword_3.cpp
90
-
// compile with: /clr
91
-
ref class X {
92
-
public:
93
-
virtual void f() abstract {} // C3634
94
-
virtual void g() = 0 {} // C3634
95
-
};
96
-
```
97
-
98
-
## See Also
99
-
[Component Extensions for Runtime Platforms](../windows/component-extensions-for-runtime-platforms.md)
35
+
36
+
The first example syntax declares a class to be abstract. The *class-declaration* component can be either a native C++ declaration (**class** or **struct**), or a C++ extension declaration (**ref class** or **ref struct**) if the `/ZW` or `/clr` compiler option is specified.
37
+
38
+
The second example syntax declares a virtual member function to be abstract. Declaring a function abstract is the same as declaring it a pure virtual function. Declaring a member function abstract also causes the enclosing class to be declared abstract.
39
+
40
+
The **abstract** keyword is supported in native and platform-specific code; that is, it can be compiled with or without the `/ZW` or `/clr` compiler option.
41
+
42
+
You can detect at compile time if a type is abstract with the `__is_abstract(type)` type trait. For more information, see [Compiler Support for Type Traits](../windows/compiler-support-for-type-traits-cpp-component-extensions.md).
43
+
44
+
The **abstract** keyword is a context-sensitive override specifier. For more information about context-sensitive keywords, see [Context-Sensitive Keywords](../windows/context-sensitive-keywords-cpp-component-extensions.md). For more information about override specifiers, see [How to: Declare Override Specifiers in Native Compilations](../dotnet/how-to-declare-override-specifiers-in-native-compilations-cpp-cli.md).
45
+
46
+
## Windows Runtime
47
+
48
+
For more information, see [Ref classes and structs](../cppcx/ref-classes-and-structs-c-cx.md).
49
+
50
+
### Requirements
51
+
52
+
Compiler option: `/ZW`
53
+
54
+
## Common Language Runtime
55
+
56
+
### Requirements
57
+
58
+
Compiler option: `/clr`
59
+
60
+
### Examples
61
+
62
+
The following code example generates an error because class `X` is marked **abstract**.
63
+
64
+
```cpp
65
+
// abstract_keyword.cpp
66
+
// compile with: /clr
67
+
ref class X abstract {
68
+
public:
69
+
virtual void f() {}
70
+
};
71
+
72
+
int main() {
73
+
X ^ MyX = gcnew X; // C3622
74
+
}
75
+
```
76
+
77
+
The following code example generates an error because it instantiates a native class that is marked **abstract**. This error will occur with or without the `/clr` compiler option.
78
+
79
+
```cpp
80
+
// abstract_keyword_2.cpp
81
+
classX abstract {
82
+
public:
83
+
virtual void f() {}
84
+
};
85
+
86
+
int main() {
87
+
X * MyX = new X; // C3622: 'X': a class declared as 'abstract'
88
+
// cannot be instantiated. See declaration of 'X'}
89
+
```
90
+
91
+
The following code example generates an error because function `f` includes a definition but is marked **abstract**. The final statement in the example shows that declaring an abstract virtual function is equivalent to declaring a pure virtual function.
92
+
93
+
```cpp
94
+
// abstract_keyword_3.cpp
95
+
// compile with: /clr
96
+
ref class X {
97
+
public:
98
+
virtual void f() abstract {} // C3634
99
+
virtual void g() = 0 {} // C3634
100
+
};
101
+
```
102
+
103
+
## See Also
104
+
105
+
[Component Extensions for Runtime Platforms](../windows/component-extensions-for-runtime-platforms.md)
Copy file name to clipboardExpand all lines: docs/windows/accelerator-editor.md
+32-29Lines changed: 32 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -13,32 +13,35 @@ ms.author: "mblome"
13
13
ms.workload: ["cplusplus", "uwp"]
14
14
---
15
15
# Accelerator Editor
16
-
An accelerator table is a 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.
17
-
18
-
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.
19
-
20
-
You can use [Class View](http://msdn.microsoft.com/8d7430a9-3e33-454c-a9e1-a85e3d2db925) to hook accelerator key commands to code.
> While using the **Accelerator** editor, you can right-click to display a shortcut menu of frequently used commands. The commands available depend on what the pointer is pointing to.
34
-
35
-
> [!NOTE]
36
-
> Windows does not 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.
37
-
38
-
For information on adding resources to managed projects, please see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index).
An accelerator table is a 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.
18
+
19
+
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.
20
+
21
+
You can use [Class View](http://msdn.microsoft.com/8d7430a9-3e33-454c-a9e1-a85e3d2db925) to hook accelerator key commands to code.
> While using the **Accelerator** editor, you can right-click to display a shortcut menu of frequently used commands. The commands available depend on what the pointer is pointing to.
35
+
36
+
> [!NOTE]
37
+
> Windows does not 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.
38
+
39
+
For information on adding resources to managed projects, please see [Resources in Desktop Apps](/dotnet/framework/resources/index) in the *.NET Framework Developer's Guide*. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resource strings to properties, see [Creating Resource Files for Desktop Apps](/dotnet/framework/resources/creating-resource-files-for-desktop-apps). For information on globalization and localization of resources in managed apps, see [Globalizing and Localizing .NET Framework Applications](/dotnet/standard/globalization-localization/index).
Copy file name to clipboardExpand all lines: docs/windows/accelerator-key-property.md
+34-31Lines changed: 34 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -12,34 +12,37 @@ ms.author: "mblome"
12
12
ms.workload: ["cplusplus", "uwp"]
13
13
---
14
14
# Accelerator Key Property
15
-
The following are legal entries for the Key property in the accelerator table:
16
-
17
-
- An integer between 0 and 255 in decimal format. The value determines whether the value is treated as ASCII or ANSI as follows:
18
-
19
-
- Single-digit numbers are always interpreted as the corresponding key, rather than as ASCII or ANSI values.
20
-
21
-
- 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.
22
-
23
-
- Values from 27-32 are always interpreted as three-digit decimal values 027 through 032.
24
-
25
-
- Values from 033 through 255, whether preceded by 0's or not are interpreted as ANSI values.
26
-
27
-
- 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.
28
-
29
-
- A single keyboard character in the range A - Z (uppercase only), preceded by a caret (^) (for example, ^C). This enters the ASCII value of the key when it is pressed with the **Ctrl** key held down.
30
-
31
-
> [!NOTE]
32
-
> When entering an ASCII value, the modifier property options are limited. The only control key available for use is the **Alt** key.
33
-
34
-
- Any valid virtual key identifier. The drop-down Key box in the Accelerator table contains a list of standard virtual key identifiers.
35
-
36
-
> [!TIP]
37
-
> Another way to define an accelerator key is to right-click an entry or multiple entries in the Accelerator table, choose **Next Key Typed** from the shortcut menu, and then press any of the keys or key combinations on the keyboard. The **Next Key Typed** command is also available from the **Edit** menu.
The following are legal entries for the Key property in the accelerator table:
17
+
18
+
- An integer between 0 and 255 in decimal format. The value determines whether the value is treated as ASCII or ANSI as follows:
19
+
20
+
- Single-digit numbers are always interpreted as the corresponding key, rather than as ASCII or ANSI values.
21
+
22
+
- 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.
23
+
24
+
- Values from 27-32 are always interpreted as three-digit decimal values 027 through 032.
25
+
26
+
- Values from 033 through 255, whether preceded by 0's or not are interpreted as ANSI values.
27
+
28
+
- 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.
29
+
30
+
- A single keyboard character in the range A - Z (uppercase only), preceded by a caret (^) (for example, ^C). This enters the ASCII value of the key when it is pressed with the **Ctrl** key held down.
31
+
32
+
> [!NOTE]
33
+
> When entering an ASCII value, the modifier property options are limited. The only control key available for use is the **Alt** key.
34
+
35
+
- Any valid virtual key identifier. The drop-down Key box in the Accelerator table contains a list of standard virtual key identifiers.
36
+
37
+
> [!TIP]
38
+
> Another way to define an accelerator key is to right-click an entry or multiple entries in the Accelerator table, choose **Next Key Typed** from the shortcut menu, and then press any of the keys or key combinations on the keyboard. The **Next Key Typed** command is also available from the **Edit** menu.
0 commit comments