示例#1
0
HRESULT _IFUNC BOleInProcServer::SaveCompleted(IStorage* pStgSaved)
{
  LPPERSISTSTORAGE pPersistCache;
  if (SUCCEEDED(pDefHandler->QueryInterface(IID_IPersistStorage, &(LPVOID) pPersistCache))) {
    pPersistCache->SaveCompleted(pStgSaved);
    pPersistCache->Release();
  }
  return BOleSite::SaveCompleted(pStgSaved);
}
示例#2
0
HRESULT _IFUNC BOleInProcServer::HandsOffStorage()
{
  LPPERSISTSTORAGE pPersistCache;
  if (SUCCEEDED(pDefHandler->QueryInterface(IID_IPersistStorage, &(LPVOID) pPersistCache))) {
    pPersistCache->HandsOffStorage();
    pPersistCache->Release();
  }
  return BOleSite::HandsOffStorage();
}
示例#3
0
HRESULT _IFUNC BOleInProcServer::Save(IStorage* pStgSave,BOOL fSameAsLoad)
{
  LPOLECACHE2 pCache;
  if (SUCCEEDED(pDefHandler->QueryInterface(IID_IOleCache2, &(LPVOID)pCache))) {
    pCache->UpdateCache(this, ADVFCACHE_ONSAVE, NULL);
    pCache->Release();
  }
  LPPERSISTSTORAGE pPersistCache;
  if (SUCCEEDED(pDefHandler->QueryInterface(IID_IPersistStorage, &(LPVOID)pPersistCache))) {
    pPersistCache->Save(pStgSave, fSameAsLoad);
    pPersistCache->Release();
  }
  return BOleSite::Save(pStgSave, fSameAsLoad);
}
示例#4
0
void CEx27bView::OnEditCopyto() 
{
    // Copy text to an .STG file (nothing special about STG ext)
    CFileDialog dlg(FALSE, "stg", "*.stg");
    if (dlg.DoModal() != IDOK) {
        return;
    }
    CEx27bDoc* pDoc = GetDocument();
    // Create a structured storage home for the object (m_pStgSub).
    //  Create a root storage file, then a substorage named "sub."
	LPSTORAGE pStgRoot;
	VERIFY(::StgCreateDocfile(dlg.GetPathName().AllocSysString(),
		   STGM_READWRITE|STGM_SHARE_EXCLUSIVE|STGM_CREATE,
		   0, &pStgRoot) == S_OK);
	ASSERT(pStgRoot != NULL);
	
	LPSTORAGE pStgSub;
    VERIFY(pStgRoot->CreateStorage(CEx27bDoc::s_szSub,
    	   STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE,
    	   0, 0, &pStgSub) == S_OK); 
	ASSERT(pStgSub != NULL);

	// Get the IPersistStorage* for the object
	LPPERSISTSTORAGE pPS = NULL;
	VERIFY(pDoc->m_lpOleObj->QueryInterface(IID_IPersistStorage,
		  (void**) &pPS) == S_OK);
    // Finally, save the object in its new home in the user's file

	VERIFY(::OleSave(pPS, pStgSub, FALSE) == S_OK); 
	// FALSE means different stg
	pPS->SaveCompleted(NULL);  // What does this do?
	pPS->Release();

	pStgSub->Release();
	pStgRoot->Release();
}