Skip to content

Commit e689e61

Browse files
authored
Merge pull request MicrosoftDocs#1493 from corob-msft/cr-C44893-fix
Update TN041 for i13n issue C44893
2 parents 27717f2 + d212185 commit e689e61

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/mfc/tn041-mfc-ole1-migration-to-mfc-ole-2.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "TN041: MFC-OLE1 Migration to MFC-OLE 2 | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "06/28/2018"
4+
ms.date: "10/18/2018"
55
ms.technology: ["cpp-mfc"]
66
ms.topic: "conceptual"
77
f1_keywords: ["vc.mfc.ole"]
@@ -283,7 +283,7 @@ At this point, OCLIENT is a functional OLE container application. It is possible
283283

284284
One of the most interesting features of OLE is in-place activation (or "Visual Editing"). This feature allows the server application to take over portions of the container's user interface to provided a more seamless editing interface for the user. To implement in-place activation to OCLIENT, some special resources need to be added, as well as some additional code. These resources and the code are normally provided by AppWizard — in fact, much of the code here was borrowed directly from a fresh AppWizard application with "Container" support.
285285

286-
First of all, it is necessary to add a menu resource to be used when there is an item which is in-place active. You can create this extra menu resource in Visual C++ by copying the IDR_OCLITYPE resource and removing all but the File and Window pop-ups. Two separator bars are inserted between the File and Window pop-ups to indicate the separation of groups (it should look like: File | | Window). For more information on what these separators mean and how the server and container menus are merged see "Menus and Resources: Menu Merging" in *OLE 2 Classes*.
286+
First of all, it is necessary to add a menu resource to be used when there is an item which is in-place active. You can create this extra menu resource in Visual C++ by copying the IDR_OCLITYPE resource and removing all but the File and Window pop-ups. Two separator bars are inserted between the File and Window pop-ups to indicate the separation of groups (it should look like: File || Window). For more information on what these separators mean and how the server and container menus are merged see [Menus and Resources: Menu Merging](../mfc/menus-and-resources-menu-merging.md).
287287

288288
Once you have these menus created, you need to let the framework know about them. This is done by calling `CDocTemplate::SetContainerInfo` for the document template before you add it to the document template list in your InitInstance. The new code to register the document template looks like this:
289289

@@ -600,7 +600,7 @@ There are many more errors in svritem.cpp that have not been addressed. They are
600600
\hiersvr\svrview.cpp(325) : error C2660: 'CopyToClipboard' : function does not take 2 parameters
601601
```
602602

603-
`COleServerItem::CopyToClipboard` no longer supports the 'bIncludeNative' flag. The native data (the data written out by the server item's Serialize function) is always copied, so you remove the first parameter. In addition, `CopyToClipboard` will throw an exception when an error happens instead of returning FALSE. Change the code for CServerView::OnEditCopy as follows:
603+
`COleServerItem::CopyToClipboard` no longer supports the `bIncludeNative` flag. The native data (the data written out by the server item's Serialize function) is always copied, so you remove the first parameter. In addition, `CopyToClipboard` will throw an exception when an error happens instead of returning FALSE. Change the code for CServerView::OnEditCopy as follows:
604604

605605
```cpp
606606
void CServerView::OnEditCopy()
@@ -636,7 +636,7 @@ To add "Visual Editing" (or in-place activation) to this server application, the
636636

637637
- You need to tell the framework about these special resources and classes.
638638

639-
The menu resource is easy to create. Run Visual C++, copy the menu resource IDR_HIERSVRTYPE to a menu resource called IDR_HIERSVRTYPE_SRVR_IP. Modify the menu so that only the Edit and Help menu popups are left. Add two separators to the menu in between the Edit and Help menus (it should look like: Edit | | Help). For more information on what these separators mean and how the server and container menus are merged, see "Menus and Resources: Menu Merging" in *OLE 2 Classes*.
639+
The menu resource is easy to create. Run Visual C++, copy the menu resource IDR_HIERSVRTYPE to a menu resource called IDR_HIERSVRTYPE_SRVR_IP. Modify the menu so that only the Edit and Help menu popups are left. Add two separators to the menu in between the Edit and Help menus (it should look like: Edit || Help). For more information on what these separators mean and how the server and container menus are merged, see [Menus and Resources: Menu Merging](../mfc/menus-and-resources-menu-merging.md).
640640

641641
The bitmap for the subset toolbar can be easily created by copying the one from a fresh AppWizard generated application with a "Server" option checked. This bitmap can then be imported into Visual C++. Be sure to give the bitmap an ID of IDR_HIERSVRTYPE_SRVR_IP.
642642

@@ -659,7 +659,7 @@ pMenu->TrackPopupMenu(TPM_CENTERALIGN | TPM_RIGHTBUTTON,
659659
AfxGetApp()->m_pMainWnd);
660660
```
661661

662-
Notice the reference to *`AfxGetApp()->m_pMainWnd*`. When the server is in-place activated, it has a main window and m_pMainWnd is set, but it is usually invisible. Furthermore, this window refers to the *main* window of the application, the MDI frame window that appears when the server is fully open or run stand-alone. It does not refer to the active frame window — which when in-place activated is a frame window derived from `COleIPFrameWnd`. To get the correct active window even when in-place editing, this version of MFC adds a new function, `AfxGetMainWnd`. Generally, you should use this function instead of *`AfxGetApp()->m_pMainWnd*`. This code needs to change as follows:
662+
Notice the reference to `AfxGetApp()->m_pMainWnd`. When the server is in-place activated, it has a main window and m_pMainWnd is set, but it is usually invisible. Furthermore, this window refers to the *main* window of the application, the MDI frame window that appears when the server is fully open or run stand-alone. It does not refer to the active frame window — which when in-place activated is a frame window derived from `COleIPFrameWnd`. To get the correct active window even when in-place editing, this version of MFC adds a new function, `AfxGetMainWnd`. Generally, you should use this function instead of `AfxGetApp()->m_pMainWnd`. This code needs to change as follows:
663663

664664
```cpp
665665
pMenu->TrackPopupMenu(TPM_CENTERALIGN | TPM_RIGHTBUTTON,

0 commit comments

Comments
 (0)