Skip to content

Commit 33f9712

Browse files
authored
Merge pull request #972 from msebolt/formatting-pr12
formatting mfc tn
2 parents 7ffd8c3 + ef8878f commit 33f9712

24 files changed

+257
-257
lines changed

docs/mfc/tabs-and-tab-control-attributes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ms.workload: ["cplusplus"]
1414
# Tabs and Tab Control Attributes
1515
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.
1616

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.
1818

1919
The following code clears the state of all tab items and then modifies the state of the third item:
2020

docs/mfc/template-based-classes.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,26 @@ This article explains the type-safe template-based collection classes in MFC ver
3434
### <a name="_core_simple_array_and_list_usage"></a> Simple Array and List Usage
3535
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:
3636

37-
- Fundamental C++ data types, such as `int`, `char`, and **float**
37+
- Fundamental C++ data types, such as **int**, **char**, and **float**
3838

3939
- C++ structures and classes
4040

4141
- Other types that you define
4242

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:
4444

4545
[!code-cpp[NVC_MFCCollections#1](../mfc/codesnippet/cpp/template-based-classes_1.cpp)]
4646

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:
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:
4848

4949
[!code-cpp[NVC_MFCCollections#2](../mfc/codesnippet/cpp/template-based-classes_2.cpp)]
5050

5151
### <a name="_core_simple_map_usage"></a> Simple Map Usage
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:
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:
5353

5454
[!code-cpp[NVC_MFCCollections#3](../mfc/codesnippet/cpp/template-based-classes_3.cpp)]
5555

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.
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.
5757

5858
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:
5959

@@ -63,7 +63,7 @@ This article explains the type-safe template-based collection classes in MFC ver
6363
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.
6464

6565
### <a name="_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`.
6767

6868
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:
6969

@@ -74,16 +74,16 @@ This article explains the type-safe template-based collection classes in MFC ver
7474
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`.
7575

7676
### <a name="_core_typed.2d.pointer_map_usage"></a> Typed-Pointer Map Usage
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:
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:
7878

7979
[!code-cpp[NVC_MFCCollections#6](../mfc/codesnippet/cpp/template-based-classes_6.cpp)]
8080

81-
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`.
8282

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`.
8484

8585
> [!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.
8787
8888
For more information, see [How to Make a Type-Safe Collection](../mfc/how-to-make-a-type-safe-collection.md).
8989

docs/mfc/the-ccmdui-class.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ When it routes an update command to its handler, the framework passes the handle
1717

1818
[!code-cpp[NVC_MFCDocView#3](../mfc/codesnippet/cpp/the-ccmdui-class_1.cpp)]
1919

20-
This handler calls the **Enable** member function of an object with access to the menu item. **Enable** makes the item available for use.
20+
This handler calls the `Enable` member function of an object with access to the menu item. `Enable` makes the item available for use.
2121

2222
## See Also
2323
[How to: Update User-Interface Objects](../mfc/how-to-update-user-interface-objects.md)

docs/mfc/thread-specific-hot-keys.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ ms.author: "mblome"
1212
ms.workload: ["cplusplus"]
1313
---
1414
# 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).
1616

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`.
1818

1919
## See Also
2020
[Using CHotKeyCtrl](../mfc/using-chotkeyctrl.md)

docs/mfc/tn001-window-class-registration.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ms.workload: ["cplusplus"]
1616
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.
1717

1818
## 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.
2020

2121
This `WNDCLASS` must be registered through one of four means:
2222

@@ -33,15 +33,15 @@ This note describes the MFC routines that register the special [WNDCLASS](http:/
3333

3434
|Field|Description|
3535
|-----------|-----------------|
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|
4545

4646
## Provided WNDCLASSes
4747
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, ...);
9292
`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).
9393

9494
## 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.
9696

9797
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.
9898

0 commit comments

Comments
 (0)