Skip to content

Commit e07eb92

Browse files
authored
Merge pull request MicrosoftDocs#964 from msebolt/cpp-formatting-pr7
formatting mfc to mf
2 parents 3f17fc7 + 3d78431 commit e07eb92

22 files changed

+72
-72
lines changed

docs/mfc/memory-management-examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ This article describes how MFC performs frame allocations and heap allocations f
7474

7575
[!code-cpp[NVC_MFC_Utilities#7](../mfc/codesnippet/cpp/memory-management-examples_7.cpp)]
7676

77-
If the argument for the `CPerson` constructor is a pointer to `char`, the statement for frame allocation is:
77+
If the argument for the `CPerson` constructor is a pointer to **char**, the statement for frame allocation is:
7878

7979
[!code-cpp[NVC_MFC_Utilities#8](../mfc/codesnippet/cpp/memory-management-examples_8.cpp)]
8080

docs/mfc/memory-management-frame-allocation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Allocation on the frame takes its name from the "stack frame" that is set up whe
1818

1919
[!code-cpp[NVC_MFC_Utilities#10](../mfc/codesnippet/cpp/memory-management-frame-allocation_1.cpp)]
2020

21-
For local function variables, this scope transition happens when the function exits, but the scope of a frame variable can be smaller than a function if nested braces are used. This automatic deletion of frame variables is very important. In the case of simple primitive types (such as `int` or **byte**), arrays, or data structures, the automatic deletion simply reclaims the memory used by the variable. Since the variable has gone out of scope, it cannot be accessed anyway. In the case of C++ objects, however, the process of automatic deletion is a bit more complicated.
21+
For local function variables, this scope transition happens when the function exits, but the scope of a frame variable can be smaller than a function if nested braces are used. This automatic deletion of frame variables is very important. In the case of simple primitive types (such as **int** or **byte**), arrays, or data structures, the automatic deletion simply reclaims the memory used by the variable. Since the variable has gone out of scope, it cannot be accessed anyway. In the case of C++ objects, however, the process of automatic deletion is a bit more complicated.
2222

2323
When an object is defined as a frame variable, its constructor is automatically invoked at the point where the definition is encountered. When the object goes out of scope, its destructor is automatically invoked before the memory for the object is reclaimed. This automatic construction and destruction can be very handy, but you must be aware of the automatic calls, especially to the destructor.
2424

docs/mfc/memory-management-heap-allocation.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
# Memory Management: Heap Allocation
15-
The heap is reserved for the memory allocation needs of the program. It is an area apart from the program code and the stack. Typical C programs use the functions `malloc` and **free** to allocate and deallocate heap memory. The Debug version of MFC provides modified versions of the C++ built-in operators **new** and **delete** to allocate and deallocate objects in heap memory.
15+
The heap is reserved for the memory allocation needs of the program. It is an area apart from the program code and the stack. Typical C programs use the functions **malloc** and **free** to allocate and deallocate heap memory. The Debug version of MFC provides modified versions of the C++ built-in operators **new** and **delete** to allocate and deallocate objects in heap memory.
1616

17-
When you use **new** and **delete** instead of `malloc` and **free**, you are able to take advantage of the class library's memory-management debugging enhancements, which can be useful in detecting memory leaks. When you build your program with the Release version of MFC, the standard versions of the **new** and **delete** operators provide an efficient way to allocate and deallocate memory (the Release version of MFC does not provide modified versions of these operators).
17+
When you use **new** and **delete** instead of **malloc** and **free**, you are able to take advantage of the class library's memory-management debugging enhancements, which can be useful in detecting memory leaks. When you build your program with the Release version of MFC, the standard versions of the **new** and **delete** operators provide an efficient way to allocate and deallocate memory (the Release version of MFC does not provide modified versions of these operators).
1818

1919
Note that the total size of objects allocated on the heap is limited only by your system's available virtual memory.
2020

docs/mfc/memory-management-resizable-memory-blocks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ms.workload: ["cplusplus"]
1515
The **new** and **delete** operators, described in the article [Memory Management: Examples](../mfc/memory-management-examples.md), are good for allocating and deallocating fixed-size memory blocks and objects. Occasionally, your application may need resizable memory blocks. You must use the standard C run-time library functions [malloc](../c-runtime-library/reference/malloc.md), [realloc](../c-runtime-library/reference/realloc.md), and [free](../c-runtime-library/reference/free.md) to manage resizable memory blocks on the heap.
1616

1717
> [!IMPORTANT]
18-
> Mixing the **new** and **delete** operators with the resizable memory-allocation functions on the same memory block will result in corrupted memory in the Debug version of MFC. You should not use `realloc` on a memory block allocated with **new**. Likewise, you should not allocate a memory block with the **new** operator and delete it with **free**, or use the **delete** operator on a block of memory allocated with `malloc`.
18+
> Mixing the **new** and **delete** operators with the resizable memory-allocation functions on the same memory block will result in corrupted memory in the Debug version of MFC. You should not use **realloc** on a memory block allocated with **new**. Likewise, you should not allocate a memory block with the **new** operator and delete it with **free**, or use the **delete** operator on a block of memory allocated with **malloc**.
1919
2020
## See Also
2121
[Memory Management: Heap Allocation](../mfc/memory-management-heap-allocation.md)

docs/mfc/menus-and-resources-container-additions.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,27 @@ This article explains the changes that need to be made to the menus and other re
4646

4747
|ID|Key|Type|
4848
|--------|---------|----------|
49-
|**ID_CANCEL_EDIT_CNTR**|VK_ESCAPE|**VIRTKEY**|
49+
|ID_CANCEL_EDIT_CNTR|VK_ESCAPE|**VIRTKEY**|
5050

51-
The second change is to create a new accelerator table that corresponds to the new menu resource created for in-place activation. This table has entries for the File and Window menus in addition to the **VK_ESCAPE** entry above. The following example is the accelerator table created for in-place activation in the MFC sample [CONTAINER](../visual-cpp-samples.md):
51+
The second change is to create a new accelerator table that corresponds to the new menu resource created for in-place activation. This table has entries for the File and Window menus in addition to the VK_ESCAPE entry above. The following example is the accelerator table created for in-place activation in the MFC sample [CONTAINER](../visual-cpp-samples.md):
5252

5353
|ID|Key|Type|
5454
|--------|---------|----------|
55-
|`ID_FILE_NEW`|CTRL+N|**VIRTKEY**|
56-
|`ID_FILE_OPEN`|CTRL+O|**VIRTKEY**|
57-
|**ID_FILE_SAVE**|CTRL+S|**VIRTKEY**|
58-
|**ID_FILE_PRINT**|CTRL+P|**VIRTKEY**|
59-
|**ID_NEXT_PANE**|VK_F6|**VIRTKEY**|
60-
|**ID_PREV_PANE**|SHIFT+VK_F6|**VIRTKEY**|
61-
|**ID_CANCEL_EDIT_CNTR**|VK_ESCAPE|**VIRTKEY**|
55+
|ID_FILE_NEW|CTRL+N|**VIRTKEY**|
56+
|ID_FILE_OPEN|CTRL+O|**VIRTKEY**|
57+
|ID_FILE_SAVE|CTRL+S|**VIRTKEY**|
58+
|ID_FILE_PRINT|CTRL+P|**VIRTKEY**|
59+
|ID_NEXT_PANE|VK_F6|**VIRTKEY**|
60+
|ID_PREV_PANE|SHIFT+VK_F6|**VIRTKEY**|
61+
|ID_CANCEL_EDIT_CNTR|VK_ESCAPE|**VIRTKEY**|
6262

6363
## <a name="_core_string_table_additions_for_container_applications"></a> String Table Additions for Container Applications
6464
Most of the changes to string tables for container applications correspond to the additional menu items mentioned in [Container Menu Additions](#_core_container_menu_additions). They supply the text displayed in the status bar when each menu item is displayed. As an example, here are the string-table entries the application wizard generates:
6565

6666
|ID|String|
6767
|--------|------------|
68-
|**IDP_OLE_INIT_FAILED**|OLE initialization failed. Make sure that the OLE libraries are the correct version.|
69-
|**IDP_FAILED_TO_CREATE**|Failed to create object. Make sure that the object is entered in the system registry.|
68+
|IDP_OLE_INIT_FAILED|OLE initialization failed. Make sure that the OLE libraries are the correct version.|
69+
|IDP_FAILED_TO_CREATE|Failed to create object. Make sure that the object is entered in the system registry.|
7070

7171
## See Also
7272
[Menus and Resources (OLE)](../mfc/menus-and-resources-ole.md)

docs/mfc/menus-and-resources-ole.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ This group of articles explains the use of menus and resources in MFC OLE docume
3030

3131
|Resource name|Use|
3232
|-------------------|---------|
33-
|**IDR_MAINFRAME**|Used in an MDI application if no file is open, or in an SDI application regardless of open files. This is the standard menu used in non-OLE applications.|
34-
|**IDR_\<project>TYPE**|Used in an MDI application if files are open. Used when an application is running stand-alone. This is the standard menu used in non-OLE applications.|
35-
|**IDR_\<project>TYPE_SRVR_IP**|Used by the server or container when an object is open in place.|
36-
|**IDR_\<project>TYPE_SRVR_EMB**|Used by a server application if an object is opened without using in-place activation.|
33+
|IDR_MAINFRAME|Used in an MDI application if no file is open, or in an SDI application regardless of open files. This is the standard menu used in non-OLE applications.|
34+
|IDR_\<project>TYPE|Used in an MDI application if files are open. Used when an application is running stand-alone. This is the standard menu used in non-OLE applications.|
35+
|IDR_\<project>TYPE_SRVR_IP|Used by the server or container when an object is open in place.|
36+
|IDR_\<project>TYPE_SRVR_EMB|Used by a server application if an object is opened without using in-place activation.|
3737

3838
Each of these resource names represents a menu and, usually, an accelerator table. A similar scheme should be used in MFC applications that are not created with the application wizard.
3939

docs/mfc/menus-and-resources-server-additions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ This article explains the changes that need to be made to the menus and other re
4141

4242
The second table is nearly an exact copy of the view's accelerator table. Any differences parallel changes made in the fully open menu mentioned in [Server Menu Additions](#_core_server_menu_additions).
4343

44-
For an example of these accelerator table changes, compare the **IDR_HIERSVRTYPE_SRVR_IP** and **IDR_HIERSVRTYPE_SRVR_EMB** accelerator tables with **IDR_MAINFRAME** in the HIERSVR.RC file included in the MFC OLE sample [HIERSVR](../visual-cpp-samples.md). The File and Window accelerators are missing from the in-place table and exact copies of them are in the embedded table.
44+
For an example of these accelerator table changes, compare the IDR_HIERSVRTYPE_SRVR_IP and IDR_HIERSVRTYPE_SRVR_EMB accelerator tables with IDR_MAINFRAME in the HIERSVR.RC file included in the MFC OLE sample [HIERSVR](../visual-cpp-samples.md). The File and Window accelerators are missing from the in-place table and exact copies of them are in the embedded table.
4545

4646
## <a name="_core_string_table_additions_for_server_applications"></a> String Table Additions for Server Applications
4747
Only one string table addition is necessary in a server application — a string to signify that the OLE initialization failed. As an example, here is the string-table entry that the application wizard generates:
4848

4949
|ID|String|
5050
|--------|------------|
51-
|**IDP_OLE_INIT_FAILED**|OLE initialization failed. Make sure that the OLE libraries are the correct version.|
51+
|IDP_OLE_INIT_FAILED|OLE initialization failed. Make sure that the OLE libraries are the correct version.|
5252

5353
## <a name="_core_mini.2d.server_additions"></a> Miniserver Additions
5454
The same additions apply for miniservers as those listed above for full-servers. Because a miniserver cannot be run in stand-alone mode, its main menu is much smaller. The main menu created by the application wizard has only a File menu, containing only the items Exit and About. Embedded and in-place menus and accelerators for miniservers are the same as those for full-servers.

docs/mfc/message-categories.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ What kinds of messages do you write handlers for There are three main categories
1616

1717
1. Windows messages
1818

19-
This includes primarily those messages beginning with the **WM_** prefix, except for **WM_COMMAND**. Windows messages are handled by windows and views. These messages often have parameters that are used in determining how to handle the message.
19+
This includes primarily those messages beginning with the **WM_** prefix, except for WM_COMMAND. Windows messages are handled by windows and views. These messages often have parameters that are used in determining how to handle the message.
2020

2121
2. Control notifications
2222

23-
This includes **WM_COMMAND** notification messages from controls and other child windows to their parent windows. For example, an edit control sends its parent a **WM_COMMAND** message containing the **EN_CHANGE** control-notification code when the user has taken an action that may have altered text in the edit control. The window's handler for the message responds to the notification message in some appropriate way, such as retrieving the text in the control.
23+
This includes WM_COMMAND notification messages from controls and other child windows to their parent windows. For example, an edit control sends its parent a WM_COMMAND message containing the EN_CHANGE control-notification code when the user has taken an action that may have altered text in the edit control. The window's handler for the message responds to the notification message in some appropriate way, such as retrieving the text in the control.
2424

25-
The framework routes control-notification messages like other **WM_** messages. One exception, however, is the **BN_CLICKED** control-notification message sent by buttons when the user clicks them. This message is treated specially as a command message and routed like other commands.
25+
The framework routes control-notification messages like other **WM_** messages. One exception, however, is the BN_CLICKED control-notification message sent by buttons when the user clicks them. This message is treated specially as a command message and routed like other commands.
2626

2727
3. Command messages
2828

29-
This includes **WM_COMMAND** notification messages from user-interface objects: menus, toolbar buttons, and accelerator keys. The framework processes commands differently from other messages, and they can be handled by more kinds of objects, as explained in [Command Targets](../mfc/command-targets.md).
29+
This includes WM_COMMAND notification messages from user-interface objects: menus, toolbar buttons, and accelerator keys. The framework processes commands differently from other messages, and they can be handled by more kinds of objects, as explained in [Command Targets](../mfc/command-targets.md).
3030

3131
## <a name="_core_windows_messages_and_control.2d.notification_messages"></a> Windows Messages and Control-Notification Messages
3232
Messages in categories 1 and 2 — Windows messages and control notifications — are handled by windows: objects of classes derived from class `CWnd`. This includes `CFrameWnd`, `CMDIFrameWnd`, `CMDIChildWnd`, `CView`, `CDialog`, and your own classes derived from these base classes. Such objects encapsulate an `HWND`, a handle to a Windows window.

docs/mfc/message-handling-and-command-targets.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The command dispatch interface `IOleCommandTarget` defines a simple and extensib
1919

2020
`IOleCommandTarget` handles the following scenarios:
2121

22-
- When an object is in-place activated, only the object's toolbars are typically displayed and the object's toolbars may have buttons for some of the container commands like **Print**, **Print Preview**, **Save**, `New`, **Zoom**, and others. (In-place activation standards recommend that objects remove such buttons from their toolbars, or at least disable them. This design allows those commands to be enabled and yet routed to the right handler.) Currently, there is no mechanism for the object to dispatch these commands to the container.
22+
- When an object is in-place activated, only the object's toolbars are typically displayed and the object's toolbars may have buttons for some of the container commands like **Print**, **Print Preview**, **Save**, **New**, **Zoom**, and others. (In-place activation standards recommend that objects remove such buttons from their toolbars, or at least disable them. This design allows those commands to be enabled and yet routed to the right handler.) Currently, there is no mechanism for the object to dispatch these commands to the container.
2323

2424
- When an active document is embedded in an active document container (such as Office Binder), the container may need to send commands such **Print**, **Page Setup**, **Properties**, and others to the contained active document.
2525

@@ -42,7 +42,7 @@ interface IOleCommandTarget : IUnknown
4242
}
4343
```
4444

45-
The `QueryStatus` method here tests whether a particular set of commands, the set being identified with a **GUID**, is supported. This call fills an array of **OLECMD** values (structures) with the supported list of commands as well as returning text describing the name of a command and/or status information. When the caller wishes to invoke a command, it can pass the command (and the set **GUID**) to **Exec** along with options and arguments, getting back a return value.
45+
The `QueryStatus` method here tests whether a particular set of commands, the set being identified with a **GUID**, is supported. This call fills an array of **OLECMD** values (structures) with the supported list of commands as well as returning text describing the name of a command and/or status information. When the caller wishes to invoke a command, it can pass the command (and the set **GUID**) to `Exec` along with options and arguments, getting back a return value.
4646

4747
## See Also
4848
[Active Document Containers](../mfc/active-document-containers.md)

docs/mfc/message-handling-and-mapping.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This article family describes how messages and commands are processed by the MFC
1616

1717
In traditional programs for Windows, Windows messages are handled in a large switch statement in a window procedure. MFC instead uses [message maps](../mfc/message-categories.md) to map direct messages to distinct class member functions. Message maps are more efficient than virtual functions for this purpose, and they allow messages to be handled by the most appropriate C++ object — application, document, view, and so on. You can map a single message or a range of messages, command IDs, or control IDs.
1818

19-
**WM_COMMAND** messages — usually generated by menus, toolbar buttons, or accelerators — also use the message-map mechanism. MFC defines a standard [routing](../mfc/command-routing.md) of command messages among the application, frame window, view, and Active documents in your program. You can override this routing if you need to.
19+
WM_COMMAND messages — usually generated by menus, toolbar buttons, or accelerators — also use the message-map mechanism. MFC defines a standard [routing](../mfc/command-routing.md) of command messages among the application, frame window, view, and Active documents in your program. You can override this routing if you need to.
2020

2121
Message maps also supply a way to update user-interface objects (such as menus and toolbar buttons), enabling or disabling them to suit the current context.
2222

0 commit comments

Comments
 (0)