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
Usually, you store and load data to and from a file via an archive in the `Serialize` functions of `CObject`-derived classes, which you must have declared with the **DECLARE_SERIALIZE** macro. A reference to a `CArchive` object is passed to your `Serialize` function. You call the `IsLoading` function of the `CArchive` object to determine whether the `Serialize` function has been called to load data from the file or store data to the file.
30
+
Usually, you store and load data to and from a file via an archive in the `Serialize` functions of `CObject`-derived classes, which you must have declared with the DECLARE_SERIALIZE macro. A reference to a `CArchive` object is passed to your `Serialize` function. You call the `IsLoading` function of the `CArchive` object to determine whether the `Serialize` function has been called to load data from the file or store data to the file.
31
31
32
32
The `Serialize` function of a serializable `CObject`-derived class typically has the following form:
The above code template is exactly the same as the one AppWizard creates for the `Serialize` function of the document (a class derived from **CDocument)**. This code template helps you write code that is easier to review, because the storing code and the loading code should always be parallel, as in the following example:
36
+
The above code template is exactly the same as the one AppWizard creates for the `Serialize` function of the document (a class derived from `CDocument`). This code template helps you write code that is easier to review, because the storing code and the loading code should always be parallel, as in the following example:
The library defines **<\<** and **>>** operators for `CArchive` as the first operand and the following data types and class types as the second operand:
Copy file name to clipboardExpand all lines: docs/mfc/using-the-dialog-editor-to-add-controls.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
@@ -12,7 +12,7 @@ ms.author: "mblome"
12
12
ms.workload: ["cplusplus"]
13
13
---
14
14
# Using the Dialog Editor to Add Controls
15
-
When you create your dialog-template resource with the [dialog editor](../windows/dialog-editor.md), you drag controls from a controls palette and drop them into the dialog box. This adds the specifications for that control type to the dialog-template resource. When you construct a dialog object and call its **Create** or `DoModal` member function, the framework creates a Windows control and places it in the dialog window on screen.
15
+
When you create your dialog-template resource with the [dialog editor](../windows/dialog-editor.md), you drag controls from a controls palette and drop them into the dialog box. This adds the specifications for that control type to the dialog-template resource. When you construct a dialog object and call its `Create` or `DoModal` member function, the framework creates a Windows control and places it in the dialog window on screen.
16
16
17
17
You can instead [create controls by hand](../mfc/adding-controls-by-hand.md) if you want. This is more work.
Copy file name to clipboardExpand all lines: docs/mfc/using-the-mfc-source-files.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
@@ -16,7 +16,7 @@ The Microsoft Foundation Class (MFC) Library supplies full source code. Header f
16
16
17
17
This family of articles explains the conventions that MFC uses to comment the various parts of each class, what these comments mean, and what you should expect to find in each section. The Visual C++ wizards use similar conventions for the classes that they create for you, and you will probably find these conventions useful for your own code.
18
18
19
-
You might be familiar with the **public**, `protected`, and `private` C++ keywords. When looking at the MFC header files, you will find that each class may have several of each of these. For example, public member variables and functions might be under more than one **public** keyword. This is because MFC separates member variables and functions based on their use, not by the type of access allowed. MFC uses `private` sparingly; even items considered implementation details are generally protected and many times are public. Although access to the implementation details is discouraged, MFC leaves the decision to you.
19
+
You might be familiar with the **public**, **protected**, and **private** C++ keywords. When looking at the MFC header files, you will find that each class may have several of each of these. For example, public member variables and functions might be under more than one **public** keyword. This is because MFC separates member variables and functions based on their use, not by the type of access allowed. MFC uses **private** sparingly; even items considered implementation details are generally protected and many times are public. Although access to the implementation details is discouraged, MFC leaves the decision to you.
20
20
21
21
In both the MFC source files and the files that the MFC Application Wizard creates, you will find comments like these within class declarations (usually in this order):
Copy file name to clipboardExpand all lines: docs/mfc/using-tooltips-in-a-cstatusbarctrl-object.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
@@ -13,10 +13,10 @@ ms.author: "mblome"
13
13
ms.workload: ["cplusplus"]
14
14
---
15
15
# Using Tooltips in a CStatusBarCtrl Object
16
-
To enable tooltips for a status bar control, create the `CStatusBarCtrl` object with the **SBT_TOOLTIPS** style.
16
+
To enable tooltips for a status bar control, create the `CStatusBarCtrl` object with the SBT_TOOLTIPS style.
17
17
18
18
> [!NOTE]
19
-
> If you are using a `CStatusBar` object to implement your status bar, use the `CStatusBar::CreateEx` function. It allows you to specify additional styles for the embedded **CStatusBarCtrl** object.
19
+
> If you are using a `CStatusBar` object to implement your status bar, use the `CStatusBar::CreateEx` function. It allows you to specify additional styles for the embedded `CStatusBarCtrl` object.
20
20
21
21
Once the `CStatusBarCtrl` object has been successfully created, use [CStatusBarCtrl::SetTipText](../mfc/reference/cstatusbarctrl-class.md#settiptext) and [CStatusBarCtrl::GetTipText](../mfc/reference/cstatusbarctrl-class.md#gettiptext) to set and retrieve the tip text for a specific pane.
Copy file name to clipboardExpand all lines: docs/mfc/using-tree-controls.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
@@ -20,7 +20,7 @@ Typical usage of a tree control ([CTreeCtrl](../mfc/reference/ctreectrl-class.md
20
20
21
21
- Put data into the control by calling the `CTreeCtrl`'s [InsertItem](../mfc/reference/ctreectrl-class.md#insertitem) function once for each data item. `InsertItem` returns a handle to the item you can use to refer to it later, such as when adding child items. A good time to initialize the data is in `OnInitDialog` (for controls in dialog boxes) or `OnInitialUpdate` (for views).
22
22
23
-
- As the user interacts with the control, it will send various notification messages. You can specify a function to handle each of the messages you want to handle by adding an **ON_NOTIFY_REFLECT** macro in your control window's message map or by adding an `ON_NOTIFY` macro to your parent window's message map. See [Tree Control Notification Messages](../mfc/tree-control-notification-messages.md) later in this topic for a list of possible notifications.
23
+
- As the user interacts with the control, it will send various notification messages. You can specify a function to handle each of the messages you want to handle by adding an ON_NOTIFY_REFLECT macro in your control window's message map or by adding an ON_NOTIFY macro to your parent window's message map. See [Tree Control Notification Messages](../mfc/tree-control-notification-messages.md) later in this topic for a list of possible notifications.
24
24
25
25
- Call the various Set member functions to set values for the control. Changes that you can make include setting the indentation and changing the text, image, or data associated with an item.
Copy file name to clipboardExpand all lines: docs/mfc/virtual-list-controls.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,25 +12,25 @@ ms.author: "mblome"
12
12
ms.workload: ["cplusplus"]
13
13
---
14
14
# Virtual List Controls
15
-
A virtual list control is a list view control that has the **LVS_OWNERDATA** style. This style enables the control to support an item count up to a `DWORD` (the default item count only extends to an `int`). However, the biggest advantage provided by this style is the ability to only have a subset of data items in memory at any one time. This allows the virtual list view control to lend itself for use with large databases of information, where specific methods of accessing data are already in place.
15
+
A virtual list control is a list view control that has the LVS_OWNERDATA style. This style enables the control to support an item count up to a **DWORD** (the default item count only extends to an **int**). However, the biggest advantage provided by this style is the ability to only have a subset of data items in memory at any one time. This allows the virtual list view control to lend itself for use with large databases of information, where specific methods of accessing data are already in place.
16
16
17
17
> [!NOTE]
18
18
> In addition to providing virtual list functionality in `CListCtrl`, MFC also provides the same functionality in the [CListView](../mfc/reference/clistview-class.md) class.
19
19
20
20
There are some compatibility issues you should be aware of when developing virtual list controls. For more information, see the Compatibility Issues section of the List-View Controls topic in the Windows SDK.
21
21
22
22
## Handling the LVN_GETDISPINFO Notification
23
-
Virtual list controls maintain very little item information. Except for the item selection and focus information, all item information is managed by the owner of the control. Information is requested by the framework via a **LVN_GETDISPINFO** notification message. To provide the requested information, the owner of the virtual list control (or the control itself) must handle this notification. This can easily be done using the Properties window (see [Mapping Messages to Functions](../mfc/reference/mapping-messages-to-functions.md)). The resultant code should look something like the following example (where `CMyDialog` owns the virtual list control object and the dialog is handling the notification):
23
+
Virtual list controls maintain very little item information. Except for the item selection and focus information, all item information is managed by the owner of the control. Information is requested by the framework via a LVN_GETDISPINFO notification message. To provide the requested information, the owner of the virtual list control (or the control itself) must handle this notification. This can easily be done using the Properties window (see [Mapping Messages to Functions](../mfc/reference/mapping-messages-to-functions.md)). The resultant code should look something like the following example (where `CMyDialog` owns the virtual list control object and the dialog is handling the notification):
In the handler for the **LVN_GETDISPINFO** notification message, you must check to see what type of information is being requested. The possible values are:
27
+
In the handler for the LVN_GETDISPINFO notification message, you must check to see what type of information is being requested. The possible values are:
28
28
29
-
-`LVIF_TEXT` The `pszText` member must be filled in.
29
+
-`LVIF_TEXT` The *pszText* member must be filled in.
30
30
31
-
-`LVIF_IMAGE` The `iImage` member must be filled in.
31
+
-`LVIF_IMAGE` The *iImage* member must be filled in.
32
32
33
-
-**LVIF_INDENT** The *iIndent* member must be filled in.
33
+
-`LVIF_INDENT` The *iIndent* member must be filled in.
34
34
35
35
-`LVIF_PARAM` The *lParam* member must be filled in. (Not present for sub-items.)
36
36
@@ -43,7 +43,7 @@ A virtual list control is a list view control that has the **LVS_OWNERDATA** sty
Because this type of list control is intended for large data sets, it is recommended that you cache requested item data to improve retrieval performance. The framework provides a cache-hinting mechanism to assist in optimizing the cache by sending an **LVN_ODCACHEHINT** notification message.
46
+
Because this type of list control is intended for large data sets, it is recommended that you cache requested item data to improve retrieval performance. The framework provides a cache-hinting mechanism to assist in optimizing the cache by sending an LVN_ODCACHEHINT notification message.
47
47
48
48
The following example updates the cache with the range passed to the handler function.
49
49
@@ -52,7 +52,7 @@ A virtual list control is a list view control that has the **LVS_OWNERDATA** sty
52
52
For more information on preparing and maintaining a cache, see the Cache Management section of the List-View Controls topic in the Windows SDK.
53
53
54
54
## Finding Specific Items
55
-
The **LVN_ODFINDITEM** notification message is sent by the virtual list control when a particular list control item needs to be found. The notification message is sent when the list view control receives quick key access or when it receives an **LVM_FINDITEM** message. Search information is sent in the form of an **LVFINDINFO** structure, which is a member of the **NMLVFINDITEM** structure. Handle this message by overriding the `OnChildNotify` function of your list control object and inside the body of the handler, check for the **LVN_ODFINDITEM** message. If found, perform the appropriate action.
55
+
The LVN_ODFINDITEM notification message is sent by the virtual list control when a particular list control item needs to be found. The notification message is sent when the list view control receives quick key access or when it receives an LVM_FINDITEM message. Search information is sent in the form of an **LVFINDINFO** structure, which is a member of the **NMLVFINDITEM** structure. Handle this message by overriding the `OnChildNotify` function of your list control object and inside the body of the handler, check for the LVN_ODFINDITEM message. If found, perform the appropriate action.
56
56
57
57
You should be prepared to search for an item that matches the information given by the list view control. You should return the index of the item if successful, or -1 if no matching item is found.
Copy file name to clipboardExpand all lines: docs/mfc/walkthrough-adding-a-d2d-object-to-an-mfc-project.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
@@ -37,7 +37,7 @@ To complete this walkthrough, you must have Visual Studio installed with the **D
37
37
38
38
1. On the **File** menu, point to **New** and then choose **Project**.
39
39
40
-
2. In the **New Project** dialog box, in the left pane under **Installed Templates**, expand **Visual C++** and then select **MFC**. In the middle pane, select **MFC Application**. In the **Name** box, type `MFCD2DWalkthrough`. Choose **OK**.
40
+
2. In the **New Project** dialog box, in the left pane under **Installed Templates**, expand **Visual C++** and then select **MFC**. In the middle pane, select **MFC Application**. In the **Name** box, type *MFCD2DWalkthrough*. Choose **OK**.
41
41
42
42
3. In the **MFC Application Wizard**, choose **Finish** without changing any settings.
43
43
@@ -121,7 +121,7 @@ To complete this walkthrough, you must have Visual Studio installed with the **D
121
121
122
122
3. On the **Messages** tab, choose **Add Custom Message**.
123
123
124
-
4. In the **Add Custom Message** dialog box, in the **Custom Windows Message** box, type `AFX_WM_DRAW2D`. In the **Message handler name** box, type `OnDraw2D`. Select the **Registered Message** option and then choose **OK**. This action adds a message handler for the `AFX_WM_DRAW2D` message to the `CMFCD2DWalkthroughView` class.
124
+
4. In the **Add Custom Message** dialog box, in the **Custom Windows Message** box, type *AFX_WM_DRAW2D*. In the **Message handler name** box, type *OnDraw2D*. Select the **Registered Message** option and then choose **OK**. This action adds a message handler for the AFX_WM_DRAW2D message to the `CMFCD2DWalkthroughView` class.
125
125
126
126
5. In the **Existing handlers** box, select `OnDraw2D`. Choose **Edit Code** to display the `CMFCD2DWalkthroughView::OnDraw2D` method. Use this code for the `CMFCD2DWalkthroughView::OnDrawD2D` method:
0 commit comments