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
Copy file name to clipboardExpand all lines: docs/mfc/tabs-and-tab-control-attributes.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ ms.workload: ["cplusplus"]
14
14
# Tabs and Tab Control Attributes
15
15
You have considerable control over the appearance and behavior of tabs that make up a tab control ([CTabCtrl](../mfc/reference/ctabctrl-class.md)). Each tab can have a label, an icon, an item state, and an application-defined 32-bit value associated with it. For each tab, you can display the icon, the label, or both.
16
16
17
-
In addition, each tab item can have three possible states: pressed, unpressed, or highlighted. This state can only be set by modifying an existing tab item. To modify an existing tab item, retrieve it with a call to [GetItem](../mfc/reference/ctabctrl-class.md#getitem), modify the `TCITEM` structure (specifically the **dwState** and **dwStateMask** data members), and then return the modified `TCITEM` structure with a call to [SetItem](../mfc/reference/ctabctrl-class.md#setitem). If you need to clear the item states of all the tab items in a `CTabCtrl` object, make a call to [DeselectAll](../mfc/reference/ctabctrl-class.md#deselectall). This function resets the state of all tab items or all items except the one currently selected.
17
+
In addition, each tab item can have three possible states: pressed, unpressed, or highlighted. This state can only be set by modifying an existing tab item. To modify an existing tab item, retrieve it with a call to [GetItem](../mfc/reference/ctabctrl-class.md#getitem), modify the `TCITEM` structure (specifically the *dwState* and *dwStateMask* data members), and then return the modified `TCITEM` structure with a call to [SetItem](../mfc/reference/ctabctrl-class.md#setitem). If you need to clear the item states of all the tab items in a `CTabCtrl` object, make a call to [DeselectAll](../mfc/reference/ctabctrl-class.md#deselectall). This function resets the state of all tab items or all items except the one currently selected.
18
18
19
19
The following code clears the state of all tab items and then modifies the state of the third item:
Copy file name to clipboardExpand all lines: docs/mfc/template-based-classes.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,26 +34,26 @@ This article explains the type-safe template-based collection classes in MFC ver
34
34
### <aname="_core_simple_array_and_list_usage"></a> Simple Array and List Usage
35
35
The simple array and list classes, [CArray](../mfc/reference/carray-class.md) and [CList](../mfc/reference/clist-class.md), take two parameters: *TYPE* and `ARG_TYPE`. These classes can store any data type, which you specify in the *TYPE* parameter:
36
36
37
-
- Fundamental C++ data types, such as `int`, `char`, and **float**
37
+
- Fundamental C++ data types, such as **int**, **char**, and **float**
38
38
39
39
- C++ structures and classes
40
40
41
41
- Other types that you define
42
42
43
-
For convenience and efficiency, you can use the `ARG_TYPE` parameter to specify the type of function arguments. Typically, you specify `ARG_TYPE` as a reference to the type you named in the *TYPE* parameter. For example:
43
+
For convenience and efficiency, you can use the *ARG_TYPE* parameter to specify the type of function arguments. Typically, you specify *ARG_TYPE* as a reference to the type you named in the *TYPE* parameter. For example:
The first example declares an array collection, `myArray`, that contains `int`s. The second example declares a list collection, `myList`, that stores `CPerson` objects. Certain member functions of the collection classes take arguments whose type is specified by the `ARG_TYPE` template parameter. For example, the **Add** member function of class `CArray` takes an `ARG_TYPE` argument:
47
+
The first example declares an array collection, `myArray`, that contains **int**s. The second example declares a list collection, `myList`, that stores `CPerson` objects. Certain member functions of the collection classes take arguments whose type is specified by the *ARG_TYPE* template parameter. For example, the `Add` member function of class `CArray` takes an *ARG_TYPE* argument:
The simple map class, [CMap](../mfc/reference/cmap-class.md), takes four parameters: *KEY*, `ARG_KEY`, *VALUE*, and `ARG_VALUE`. Like the array and list classes, the map classes can store any data type. Unlike arrays and lists, which index and order the data they store, maps associate keys and values: You access a value stored in a map by specifying the value's associated key. The *KEY* parameter specifies the data type of the keys used to access data stored in the map. If the type of *KEY* is a structure or class, the `ARG_KEY` parameter is typically a reference to the type specified in *KEY*. The *VALUE* parameter specifies the type of the items stored in the map. If the type of `ARG_VALUE` is a structure or class, the `ARG_VALUE` parameter is typically a reference to the type specified in *VALUE*. For example:
52
+
The simple map class, [CMap](../mfc/reference/cmap-class.md), takes four parameters: *KEY*, *ARG_KEY*, *VALUE*, and *ARG_VALUE*. Like the array and list classes, the map classes can store any data type. Unlike arrays and lists, which index and order the data they store, maps associate keys and values: You access a value stored in a map by specifying the value's associated key. The *KEY* parameter specifies the data type of the keys used to access data stored in the map. If the type of *KEY* is a structure or class, the *ARG_KEY* parameter is typically a reference to the type specified in *KEY*. The *VALUE* parameter specifies the type of the items stored in the map. If the type of *ARG_VALUE* is a structure or class, the *ARG_VALUE* parameter is typically a reference to the type specified in *VALUE*. For example:
The first example stores `MY_STRUCT` values, accesses them by `int` keys, and returns accessed `MY_STRUCT` items by reference. The second example stores `CPerson` values, accesses them by `CString` keys, and returns references to accessed items. This example might represent a simple address book, in which you look up persons by last name.
56
+
The first example stores `MY_STRUCT` values, accesses them by **int** keys, and returns accessed `MY_STRUCT` items by reference. The second example stores `CPerson` values, accesses them by `CString` keys, and returns references to accessed items. This example might represent a simple address book, in which you look up persons by last name.
57
57
58
58
Because the *KEY* parameter is of type `CString` and the *KEY_TYPE* parameter is of type `LPCSTR`, the keys are stored in the map as items of type `CString` but are referenced in functions such as `SetAt` through pointers of type `LPCSTR`. For example:
59
59
@@ -63,7 +63,7 @@ This article explains the type-safe template-based collection classes in MFC ver
63
63
To use the typed-pointer collection templates, you need to know what kinds of data you can store in these collections and what parameters to use in your collection declarations.
64
64
65
65
### <aname="_core_typed.2d.pointer_array_and_list_usage"></a> Typed-Pointer Array and List Usage
66
-
The typed-pointer array and list classes, [CTypedPtrArray](../mfc/reference/ctypedptrarray-class.md) and [CTypedPtrList](../mfc/reference/ctypedptrlist-class.md), take two parameters: `BASE_CLASS` and *TYPE*. These classes can store any data type, which you specify in the *TYPE* parameter. They are derived from one of the nontemplate collection classes that stores pointers; you specify this base class in `BASE_CLASS`. For arrays, use either `CObArray` or `CPtrArray`. For lists, use either `CObList` or `CPtrList`.
66
+
The typed-pointer array and list classes, [CTypedPtrArray](../mfc/reference/ctypedptrarray-class.md) and [CTypedPtrList](../mfc/reference/ctypedptrlist-class.md), take two parameters: *BASE_CLASS* and *TYPE*. These classes can store any data type, which you specify in the *TYPE* parameter. They are derived from one of the nontemplate collection classes that stores pointers; you specify this base class in *BASE_CLASS*. For arrays, use either `CObArray` or `CPtrArray`. For lists, use either `CObList` or `CPtrList`.
67
67
68
68
In effect, when you declare a collection based on, say `CObList`, the new class not only inherits the members of its base class, but it also declares a number of additional type-safe member functions and operators that help provide type safety by encapsulating calls to the base class members. These encapsulations manage all necessary type conversion. For example:
69
69
@@ -74,16 +74,16 @@ This article explains the type-safe template-based collection classes in MFC ver
74
74
The second example declares a typed-pointer list, `myList`, derived from `CPtrList`. The list stores and returns pointers to `MY_STRUCT` objects. A class based on `CPtrList` is used for storing pointers to objects not derived from `CObject`. `CTypedPtrList` has a number of type-safe member functions: `GetHead`, `GetTail`, `RemoveHead`, `RemoveTail`, `GetNext`, `GetPrev`, and `GetAt`.
The typed-pointer map class, [CTypedPtrMap](../mfc/reference/ctypedptrmap-class.md), takes three parameters: `BASE_CLASS`, *KEY*, and *VALUE*. The `BASE_CLASS` parameter specifies the class from which to derive the new class: `CMapPtrToWord`, `CMapPtrToPtr`, `CMapStringToPtr`, `CMapWordToPtr`, `CMapStringToOb`, and so on. *KEY* is analogous to *KEY* in `CMap`: It specifies the type of the key used for lookups. *VALUE* is analogous to *VALUE* in `CMap`: It specifies the type of object stored in the map. For example:
77
+
The typed-pointer map class, [CTypedPtrMap](../mfc/reference/ctypedptrmap-class.md), takes three parameters: *BASE_CLASS*, *KEY*, and *VALUE*. The *BASE_CLASS* parameter specifies the class from which to derive the new class: `CMapPtrToWord`, `CMapPtrToPtr`, `CMapStringToPtr`, `CMapWordToPtr`, `CMapStringToOb`, and so on. *KEY* is analogous to *KEY* in `CMap`: It specifies the type of the key used for lookups. *VALUE* is analogous to *VALUE* in `CMap`: It specifies the type of object stored in the map. For example:
The first example is a map based on **CMapPtrToPt**r — it uses `CString` keys mapped to pointers to `MY_STRUCT`. You can look up a stored pointer by calling a type-safe `Lookup` member function. You can use the **[]** operator to look up a stored pointer and add it if not found. And you can iterate the map using the type-safe `GetNextAssoc` function. You can also call other member functions of class `CMapPtrToPtr`.
81
+
The first example is a map based on `CMapPtrToPtr` — it uses `CString` keys mapped to pointers to `MY_STRUCT`. You can look up a stored pointer by calling a type-safe `Lookup` member function. You can use the **[]** operator to look up a stored pointer and add it if not found. And you can iterate the map using the type-safe `GetNextAssoc` function. You can also call other member functions of class `CMapPtrToPtr`.
82
82
83
-
The second example is a map based on **CMapStringToO**b — it uses string keys mapped to stored pointers to `CMyObject` objects. You can use the same type-safe members described in the previous paragraph, or you can call members of class `CMapStringToOb`.
83
+
The second example is a map based on `CMapStringToOb` — it uses string keys mapped to stored pointers to `CMyObject` objects. You can use the same type-safe members described in the previous paragraph, or you can call members of class `CMapStringToOb`.
84
84
85
85
> [!NOTE]
86
-
> If you specify a **class** or `struct` type for the *VALUE* parameter, rather than a pointer or reference to the type, the class or structure must have a copy constructor.
86
+
> If you specify a **class** or **struct** type for the *VALUE* parameter, rather than a pointer or reference to the type, the class or structure must have a copy constructor.
87
87
88
88
For more information, see [How to Make a Type-Safe Collection](../mfc/how-to-make-a-type-safe-collection.md).
Copy file name to clipboardExpand all lines: docs/mfc/thread-specific-hot-keys.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,9 +12,9 @@ ms.author: "mblome"
12
12
ms.workload: ["cplusplus"]
13
13
---
14
14
# Thread-Specific Hot Keys
15
-
An application sets a thread-specific hot key ([CHotKeyCtrl](../mfc/reference/chotkeyctrl-class.md)) by using the Windows **RegisterHotKey** function. When the user presses a thread-specific hot key, Windows posts a [WM_HOTKEY](http://msdn.microsoft.com/library/windows/desktop/ms646279) message to the beginning of a particular thread's message queue. The **WM_HOTKEY** message contains the virtual key code, shift state, and user-defined ID of the specific hot key that was pressed. For a list of standard virtual key codes, see Winuser.h. For more information on this method, see [RegisterHotKey](http://msdn.microsoft.com/library/windows/desktop/ms646309).
15
+
An application sets a thread-specific hot key ([CHotKeyCtrl](../mfc/reference/chotkeyctrl-class.md)) by using the Windows `RegisterHotKey` function. When the user presses a thread-specific hot key, Windows posts a [WM_HOTKEY](http://msdn.microsoft.com/library/windows/desktop/ms646279) message to the beginning of a particular thread's message queue. The WM_HOTKEY message contains the virtual key code, shift state, and user-defined ID of the specific hot key that was pressed. For a list of standard virtual key codes, see Winuser.h. For more information on this method, see [RegisterHotKey](http://msdn.microsoft.com/library/windows/desktop/ms646309).
16
16
17
-
Note that the shift state flags used in the call to **RegisterHotKey** are not the same as those returned by the [GetHotKey](../mfc/reference/chotkeyctrl-class.md#gethotkey) member function; you'll have to translate these flags before calling **RegisterHotKey**.
17
+
Note that the shift state flags used in the call to `RegisterHotKey` are not the same as those returned by the [GetHotKey](../mfc/reference/chotkeyctrl-class.md#gethotkey) member function; you'll have to translate these flags before calling `RegisterHotKey`.
Copy file name to clipboardExpand all lines: docs/mfc/tn001-window-class-registration.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ ms.workload: ["cplusplus"]
16
16
This note describes the MFC routines that register the special [WNDCLASS](http://msdn.microsoft.com/library/windows/desktop/ms633576)es needed by Microsoft Windows. Specific `WNDCLASS` attributes used by MFC and Windows are discussed.
17
17
18
18
## The Problem
19
-
The attributes of a [CWnd](../mfc/reference/cwnd-class.md) object, like an `HWND` handle in Windows, are stored in two places: the window object and the `WNDCLASS`. The name of the `WNDCLASS` is passed to general window creation functions such as [CWnd::Create](../mfc/reference/cwnd-class.md#create) and [CFrameWnd::Create](../mfc/reference/cframewnd-class.md#create) in the `lpszClassName` parameter.
19
+
The attributes of a [CWnd](../mfc/reference/cwnd-class.md) object, like an `HWND` handle in Windows, are stored in two places: the window object and the `WNDCLASS`. The name of the `WNDCLASS` is passed to general window creation functions such as [CWnd::Create](../mfc/reference/cwnd-class.md#create) and [CFrameWnd::Create](../mfc/reference/cframewnd-class.md#create) in the *lpszClassName* parameter.
20
20
21
21
This `WNDCLASS` must be registered through one of four means:
22
22
@@ -33,15 +33,15 @@ This note describes the MFC routines that register the special [WNDCLASS](http:/
33
33
34
34
|Field|Description|
35
35
|-----------|-----------------|
36
-
|`lpfnWndProc`|window proc, must be an `AfxWndProc`|
37
-
|`cbClsExtra`|not used (should be zero)|
38
-
|`cbWndExtra`|not used (should be zero)|
39
-
|`hInstance`|automatically filled with [AfxGetInstanceHandle](../mfc/reference/application-information-and-management.md#afxgetinstancehandle)|
40
-
|`hIcon`|icon for frame windows, see below|
41
-
|`hCursor`|cursor for when mouse is over window, see below|
42
-
|`hbrBackground`|background color, see below|
43
-
|`lpszMenuName`|not used (should be NULL)|
44
-
|`lpszClassName`|class name, see below|
36
+
|*lpfnWndProc*|window proc, must be an `AfxWndProc`|
37
+
|*cbClsExtra*|not used (should be zero)|
38
+
|*cbWndExtra*|not used (should be zero)|
39
+
|*hInstance*|automatically filled with [AfxGetInstanceHandle](../mfc/reference/application-information-and-management.md#afxgetinstancehandle)|
40
+
|*hIcon*|icon for frame windows, see below|
41
+
|*hCursor*|cursor for when mouse is over window, see below|
42
+
|*hbrBackground*|background color, see below|
43
+
|*lpszMenuName*|not used (should be NULL)|
44
+
|*lpszClassName*|class name, see below|
45
45
46
46
## Provided WNDCLASSes
47
47
Earlier versions of MFC (before MFC 4.0), provided several predefined Window classes. These Window classes are no longer provided by default. Applications should use `AfxRegisterWndClass` with the appropriate parameters.
@@ -92,7 +92,7 @@ pWnd->Create(strWndClass, ...);
92
92
`AfxRegisterWndClass` will throw a [CResourceException](../mfc/reference/cresourceexception-class.md) if the window class failed to register (either because of bad parameters, or out of Windows memory).
93
93
94
94
## The RegisterClass and AfxRegisterClass Functions
95
-
If you want to do anything more sophisticated than what `AfxRegisterWndClass` provides, you can call the Windows API `RegisterClass` or the MFC function `AfxRegisterClass`. The `CWnd`, [CFrameWnd](../mfc/reference/cframewnd-class.md) and [CMDIChildWnd](../mfc/reference/cmdichildwnd-class.md)`Create` functions take a `lpszClassName` string name for the window class as the first parameter. You can use any registered window class name, regardless of the method you used to register it.
95
+
If you want to do anything more sophisticated than what `AfxRegisterWndClass` provides, you can call the Windows API `RegisterClass` or the MFC function `AfxRegisterClass`. The `CWnd`, [CFrameWnd](../mfc/reference/cframewnd-class.md) and [CMDIChildWnd](../mfc/reference/cmdichildwnd-class.md)`Create` functions take a *lpszClassName* string name for the window class as the first parameter. You can use any registered window class name, regardless of the method you used to register it.
96
96
97
97
It is important to use `AfxRegisterClass` (or `AfxRegisterWndClass`) in a DLL on Win32. Win32 does not automatically unregister classes registered by a DLL, so you must explicitly unregister classes when the DLL is terminated. By using `AfxRegisterClass` instead of `RegisterClass` this is handled automatically for you. `AfxRegisterClass` maintains a list of unique classes registered by your DLL and will automatically unregister them when the DLL terminates. When you use `RegisterClass` in a DLL, you must ensure that all classes are unregistered when the DLL is terminated (in your [DllMain](http://msdn.microsoft.com/library/windows/desktop/ms682583) function). Failure to do so might cause `RegisterClass` to fail unexpectedly when another client application tries to use your DLL.
0 commit comments