// @pymethod |PyIPersistFile|SaveCompleted|Notifies the object that it can revert from NoScribble mode to Normal mode. PyObject *PyIPersistFile::SaveCompleted(PyObject *self, PyObject *args) { IPersistFile *pIPF = GetI(self); if ( pIPF == NULL ) return NULL; // @pyparm str|FileName||Absolute path of the file where the object was saved. PyObject *obFileName; TmpWCHAR FileName; if ( !PyArg_ParseTuple(args, "O:SaveCompleted", &obFileName) ) return NULL; if (!PyWinObject_AsWCHAR(obFileName, &FileName)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIPF->SaveCompleted(FileName ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIPF, IID_IPersistFile); Py_INCREF(Py_None); return Py_None; }
HRESULT CSite::Save(LPCTSTR pchPath) { HRESULT hr = S_OK; // OLECHAR szwName[256]; USES_CONVERSION; LPWSTR szwName = T2W(const_cast<LPTSTR>(pchPath)); LPOLESTR pszwName = szwName; LPOLESTR *ppszwName = &pszwName; IPersistFile* pPFile = NULL; hr = m_pObj->QueryInterface( IID_IPersistFile, (void **) &pPFile); if ( SUCCEEDED(hr) && pPFile) { if ( pchPath != NULL && *pchPath != 0) { // MultiByteToWideChar(CP_ACP, 0, pchPath, -1, szwName, 256); } else { hr = pPFile->GetCurFile(ppszwName); } if ( SUCCEEDED(hr) && ppszwName) { // Call Save on the IPersistFile hr = pPFile->Save(*ppszwName, TRUE); if ( SUCCEEDED(hr) ) { hr = pPFile->SaveCompleted(*ppszwName); } } ReleaseInterface(pPFile); } return hr; }