OLE Server Presentation Data Problem
tstewa00 -- tstewa00@colybrand.com Monday, December 23, 1996 Environment: VC++ 1.52, Windows 3.1 Dear MFC Collective, I generated my project using AppWizard as a OLE Server. It is basically a text editor. We are using a third party MFC CView derived view for the RTF text. I would like the presentation data to display the first page of the document. I assume that this is done in the CMySrvrItem::OnDraw(CDC* pDC, CSize& rSize) function. Here is some what I am trying: BOOL CMySrvrItem::OnDraw(CDC* pDC, CSize& rSize) // Class is derived from COleServerItem { CTeditDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDC->SetMapMode(MM_ANISOTROPIC); pDC->SetWindowOrg(0,0); pDC->SetWindowExt(3000, 3000); /* Here's my code */ POSITION pos=pDoc->GetFirstViewPosition(); CThirdPartyRTFView *view = (CThirdPartyRTFView*)pDoc->GetNextView(pos); // get our view view->OnDraw(pDC); /* End of my code */ return TRUE; } I am getting a stack overflow even if the document consists of 3 lines. Thank you very much for your help. Timothy "UML" Stewart
Bing Hou -- hou@tfn.com Tuesday, December 24, 1996 Hi Timothy, You got a stack overflaw because you're calling CMySrvrItem::OnDraw inside CMySrvrItem::OnDraw via the call 'view->OnDraw'. When in-place activated, you're drawing into a metafile, there isn't a CThirdPartyRTFView object around. Normally you'd manually draw whatever the representation yourself instead of delegating the task to your ThirdPartyView class. Hope this gives you some idea. -Bing. ______________________________ Reply Separator _________________________________ Subject: OLE Server Presentation Data Problem Author: tstewa00at Internet Date: 12/23/96 5:31 PM Environment: VC++ 1.52, Windows 3.1 Dear MFC Collective, I generated my project using AppWizard as a OLE Server. It is basically a text editor. We are using a third party MFC CView derived view for the RTF text. I would like the presentation data to display the first page of the document. I assume that this is done in the CMySrvrItem::OnDraw(CDC* pDC, CSize& rSize) function. Here is some what I am trying: BOOL CMySrvrItem::OnDraw(CDC* pDC, CSize& rSize) // Class is derived from COleServerItem { CTeditDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); pDC->SetMapMode(MM_ANISOTROPIC); pDC->SetWindowOrg(0,0); pDC->SetWindowExt(3000, 3000); /* Here's my code */ POSITION pos=pDoc->GetFirstViewPosition(); CThirdPartyRTFView *view = (CThirdPartyRTFView*)pDoc->GetNextView(pos); // get our view view->OnDraw(pDC); /* End of my code */ return TRUE; } I am getting a stack overflow even if the document consists of 3 lines. Thank you very much for your help. Timothy "UML" Stewart
tstewa00 -- tstewa00@colybrand.com Monday, December 30, 1996 Environment: VC++ 1.52, Windows 3.1 I apologize for putting too many superflous details in my question last time. Thanks, Bing, for answering. Here's goes: I have a multiple paged ole text document. I would like the OLE presentation data (a WMF) to display the first page. Is this possible? Thanks a lot. Timothy Stewart
Bing Hou -- hou@tfn.com Tuesday, December 31, 1996 Timothy, If I understand your question correctly, to tailor the OLE presentation data to your like, you would draw the data in your COleServerItem's OnDraw function. In your case, you'd copy the code that draws the first page of the multiple-paged text document from whereever to your COleServerItem's OnDraw function. If however the code cannot be copied, say it's a OLE control itself, I haven't tried this myself, but you may create an instance of the control in your CInPlaceFrame,(CInPlaceFrame::OnCreateControlBars may be the place) and ask the control to draw the first page in the CInPlaceFrame's space instead of using COleServerItem's drawing function. Again, this is just a way to try if you don't have better solutions. Hope this at least is relavent to what you asked. -Bing. ______________________________ Reply Separator _________________________________ Subject: OLE Server Presentation Data Problem Author: tstewa00at Internet Date: 12/30/96 8:36 AM Environment: VC++ 1.52, Windows 3.1 I apologize for putting too many superflous details in my question last time. Thanks, Bing, for answering. Here's goes: I have a multiple paged ole text document. I would like the OLE presentation data (a WMF) to display the first page. Is this possible? Thanks a lot. Timothy Stewart
| Вернуться в корень Архива |