Originally posted by: Joachim Kittelberger
Is it possible to share the menu and the toolbar of the container with the menu and toolbar of the document.
For example: A menu-entry for saving the workspace in the file menu of the container. How can I display this entry independent of the MDI-Document in the File-Menu?
If my container has a toolbar, how can I share this toolbar with the toolbars of the document on the same rebar?
Originally posted by: Andrew Garbuzov
Here are some improvements to my code for ActiveX document container. If you work with Visual C++ 6.0, you
might want to use standard MFC classes.
To let the code understand when the ActiveX document is modified and when it is not i changed the code of
CAXDocContainerDoc::OnSaveDocument method. Since the item is created using method CreateFromFile (i believe
that IPersistFile is used) it is better to use this interface when saving the document.
BOOL CAXDocContainerDoc::OnSaveDocument(LPCTSTR lpszPathName)
WCHAR* wcPathName=T2W(lpszPathName);
IPersistFile* pPersistFile=NULL;
Then CAXDocContainerDoc::IsModified method has been implemented to let MFC know when the document has been
modified by user.
BOOL CAXDocContainerDoc::IsModified()
return COleDocument::IsModified();
void CAXDocContainerView::OnInitialUpdate()
// TODO: remove this code when final selection model code is written
if(GetDocItem())
void CAXDocContainerView::OnTimer(UINT nIDEvent)
CView::OnTimer(nIDEvent);
Regards,
Hi All,
{
// TODO: Add your specialized code here and/or call the base class
USES_CONVERSION;
BOOL bSuccess=FALSE;
if(SUCCEEDED(GetDocItem()->m_lpObject->QueryInterface(
IID_IPersistFile,
(void**)&pPersistFile)))
{
if(SUCCEEDED(pPersistFile->Save(wcPathName,TRUE)))
{
pPersistFile->SaveCompleted(wcPathName);
bSuccess=TRUE;
}
pPersistFile->Release();
}
return bSuccess;
}
{
CAXDocContainerCntrItem* pItem=GetDocItem();
if(pItem)
{
IOleObject* pOleObject=pItem->m_lpObject;
IPersistFile* pPersistFile=NULL;
if(pOleObject &&
SUCCEEDED(pOleObject->QueryInterface(
IID_IPersistFile,
(void**)&pPersistFile)))
{
SetModifiedFlag(pPersistFile->IsDirty()!=S_FALSE);
pPersistFile->Release();
}
}
}
If the MDI child frame is in the maximized state when the item is activated you will get strange
assertion messages from MFC when switching between different ActiveX documents (Excel and Word for instance)
and not all toolbars will be removed and shown properly during this switch. This feature also exists in
Visual C++ 6 MFC classes. I succeeded to solve the problem by activating the item in the OnTimer method
instead of OnInitialUpdate of the CAXDocContainerView class.
{
CView::OnInitialUpdate();
CAXDocContainerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
SetTimer(1234,1000,NULL);
}
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent==1234)
{
GetDocItem()->DoVerb(OLEIVERB_SHOW,this);
KillTimer(nIDEvent);
}
}
Andrew Garbuzov (andrew@skif.net)