p_docs = new CDocuments(p_app->get_Documents()); return NULL Why ????

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 ;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top