R
RAHUL
Hi All,
I have opened a PPT file using the OLE interfaces, it opens properly
and I am able to edit it, however when I try to save it using the
following code, the Save call fails
void createFromExistingFile()
{
if (SUCCEEDED(hr = CreateBindCtx(0, &_pbctx)))
{
BIND_OPTS bopts = {sizeof(BIND_OPTS), BIND_MAYBOTHERUSER, 0,
10000};
bopts.grfMode = (STGM_TRANSACTED | STGM_SHARE_DENY_WRITE |
STGM_READWRITE);
if (SUCCEEDED(hr = _pbctx->SetBindOptions(&bopts)) &&
SUCCEEDED(hr = CreateFileMoniker(*pbstrFile, &_pmkfile)))
{
// Bind to the object moniker refers to...
hr = _pmkfile->BindToObject(_pbctx, NULL, IID_IOleObject, (void**)
&_poleobj);
}
......... some code
}
void Save()
{
IPersistMoniker *prstMk;
if (SUCCEEDED(hr = _poleobj->QueryInterface(IID_IPersistMoniker,
(void**)&prstMk)))
{
IMoniker * pmk;
hr = prstMk->GetCurMoniker(&pmk);
hr = prstMk->Save(pmk, _pbctx, TRUE); // _pbctx
// Though the above call saves the file properly yet the return code
contains E_FAIL. How do I get the more detailed information about the
error which is happening here. Could somebody please tell what might
be going wrong here. When it is saving the file properly then why does
it return E_FAIL.
Thanks in advance
Rahul
I have opened a PPT file using the OLE interfaces, it opens properly
and I am able to edit it, however when I try to save it using the
following code, the Save call fails
void createFromExistingFile()
{
if (SUCCEEDED(hr = CreateBindCtx(0, &_pbctx)))
{
BIND_OPTS bopts = {sizeof(BIND_OPTS), BIND_MAYBOTHERUSER, 0,
10000};
bopts.grfMode = (STGM_TRANSACTED | STGM_SHARE_DENY_WRITE |
STGM_READWRITE);
if (SUCCEEDED(hr = _pbctx->SetBindOptions(&bopts)) &&
SUCCEEDED(hr = CreateFileMoniker(*pbstrFile, &_pmkfile)))
{
// Bind to the object moniker refers to...
hr = _pmkfile->BindToObject(_pbctx, NULL, IID_IOleObject, (void**)
&_poleobj);
}
......... some code
}
void Save()
{
IPersistMoniker *prstMk;
if (SUCCEEDED(hr = _poleobj->QueryInterface(IID_IPersistMoniker,
(void**)&prstMk)))
{
IMoniker * pmk;
hr = prstMk->GetCurMoniker(&pmk);
hr = prstMk->Save(pmk, _pbctx, TRUE); // _pbctx
// Though the above call saves the file properly yet the return code
contains E_FAIL. How do I get the more detailed information about the
error which is happening here. Could somebody please tell what might
be going wrong here. When it is saving the file properly then why does
it return E_FAIL.
Thanks in advance
Rahul