A
agilegeek
Hi,
In the code below,
p_docs is returning as NULL...
Kindly suggest...
-----------------------------------
CApplication* p_app = NULL;
CDocuments* p_docs = NULL;
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
COleVariant covTrue((short)TRUE);
COleVariant covFalse((short)FALSE);
//COleVariant covFormat((short)CDocuments::
OleInitialize(NULL);
p_app = new CApplication();
int bRet = 0;
COleException err;
bRet = p_app->CreateDispatch("Word.Application",&err);
if (!(bRet))
{
// We found an error. Set Error string and Error Code and return.
delete p_app;
return ;
}
p_app->put_Visible(1);
try
{
p_docs = new CDocuments(p_app->get_Documents());
if ( p_docs == NULL )
{
p_app->Quit(covFalse, covFalse, covFalse);
delete p_app;
return ;
}
}
In the code below,
p_docs is returning as NULL...
Kindly suggest...
-----------------------------------
CApplication* p_app = NULL;
CDocuments* p_docs = NULL;
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
COleVariant covTrue((short)TRUE);
COleVariant covFalse((short)FALSE);
//COleVariant covFormat((short)CDocuments::
OleInitialize(NULL);
p_app = new CApplication();
int bRet = 0;
COleException err;
bRet = p_app->CreateDispatch("Word.Application",&err);
if (!(bRet))
{
// We found an error. Set Error string and Error Code and return.
delete p_app;
return ;
}
p_app->put_Visible(1);
try
{
p_docs = new CDocuments(p_app->get_Documents());
if ( p_docs == NULL )
{
p_app->Quit(covFalse, covFalse, covFalse);
delete p_app;
return ;
}
}