15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


OLE 2.0 Server with Multiple CViews

Todd A Christensen -- toddchristensen@juno.com
Monday, October 07, 1996

Environment: VC++ 4.1, Win 95, NT 4.0

I have a MFC application using VC 4.1 and Doc-View architecture. I have
one document with two views.  I am trying to make it an OLE 2.0 Server. 
MFC makes it really easy to do this with one view, however I am having
tough time getting both views to be displayed.  I know it has something
to do with the COleServerItem class.  I have a COleServerItem class for
each of my views. CMyDoc::OnGetEmbeddedItem() gets called and I return
the first Server item, but CMyDoc::OnGetLinkedItem(LPCTSTR lpszItemName)
never gets called to return  my second Server item. So I guess that MFC
supports, but does not use linked server items.

I tried to call the second Server item OnDraw from the first Server item
OnDraw, after adjusting the display area, but still only the first is
displayed. I have overwritten OnGetExtent() for both Server items,
adjusting the extent as appropriate. It seems like I need to do something
at a higher level than the OnDraw.

Any help would be appreciated.

Thanks
Todd





Mike Blaszczak -- mikeblas@nwlink.com
Tuesday, October 08, 1996

At 11:23 10/7/96 EDT, Todd A Christensen wrote:
>Environment: VC++ 4.1, Win 95, NT 4.0

>I have a MFC application using VC 4.1 and Doc-View architecture. I have
>one document with two views.  I am trying to make it an OLE 2.0 Server. 
>MFC makes it really easy to do this with one view, however I am having
>tough time getting both views to be displayed. 

I'm not sure I understand your question. _How_ do you want both views
to be displayed? Do you want the client to offer your server two rectangles
in its window, one for each view?  Or do you want to split the rectangle
you're offered into two windows and use one for each of the views?

>CMyDoc::OnGetEmbeddedItem() gets called and I return
>the first Server item, but CMyDoc::OnGetLinkedItem(LPCTSTR lpszItemName)
>never gets called to return  my second Server item.

If you're being inserted as an embedded object, MFC will call
OnGetEmbeddedItem().  If you're being inserted as a linked object, MFC
will call OnGetLinkedItem().  If OnGetLinkedItem() isn't getting called,
it's only because you're getting embedded and not linked.

.B ekiM
http://www.nwlink.com/~mikeblas/
Don't look at my hands: look at my _shoulders_!
These words are my own. I do not speak on behalf of Microsoft.





| Вернуться в корень Архива |