Click here to Skip to main content
15,889,488 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Error in building QuickFix library in Exceptions.h Pin
David Crow9-Jul-10 9:04
David Crow9-Jul-10 9:04 
AnswerRe: Error in building QuickFix library in Exceptions.h Pin
Aescleal9-Jul-10 10:13
Aescleal9-Jul-10 10:13 
GeneralRe: Error in building QuickFix library in Exceptions.h Pin
arupsarkar16-Jul-10 6:46
arupsarkar16-Jul-10 6:46 
Questionerror C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ................... Pin
deadlyabbas9-Jul-10 5:23
deadlyabbas9-Jul-10 5:23 
QuestionRe: error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ................... Pin
David Crow9-Jul-10 5:50
David Crow9-Jul-10 5:50 
AnswerRe: error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ................... Pin
Stuart Dootson11-Jul-10 0:46
professionalStuart Dootson11-Jul-10 0:46 
QuestionMFC crash occurs on DLL during language translation in string table entries Pin
Thirumalesh.U8-Jul-10 23:40
Thirumalesh.U8-Jul-10 23:40 
QuestionRun-time Error while word 2010 Automation, "A null reference pointer was passed to the stub." [modified] Pin
m_code8-Jul-10 23:04
m_code8-Jul-10 23:04 
Hi, I want to Automate MS Word 2010 to extract text with the following code. but I get run-time error "A null reference pointer was passed to the stub."
am I doing something wrong?
CString strDocFile(L"C:\\a.doc");

COleVariant covTrue((short)TRUE), covFalse((short)FALSE), covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);


CApplication appObj;


if(!appObj.CreateDispatch(L"Word.Application"))
{
    AfxMessageBox(L"could Not Create The Application Object");
    return;
}

appObj.put_Visible(FALSE);

CDocuments docsObj(appObj.get_Documents());

CDocument0 docObj;



COleVariant oleStrFile(strDocFile.GetString(),VT_BSTR);

LPDISPATCH pIDoc = docsObj.Open(
    oleStrFile,
    covFalse,    // Confirm Conversion.
    covFalse,    // ReadOnly.
    covFalse,    // AddToRecentFiles.
    covOptional, // PasswordDocument.
    covOptional, // PasswordTemplate.
    covFalse,    // Revert.
    covOptional, // WritePasswordDocument.
    covOptional, // WritePasswordTemplate.
    covOptional, // Format. // Last argument for Word 97
    covOptional, // Encoding // New for Word 2000/2002
    covTrue,     // Visible
    //covOptional, // OpenConflictDocument
    covOptional, // OpenAndRepair
    (long)0,     // DocumentDirection wdDocumentDirection LeftToRight
    covOptional,  // NoEncodingDialog
    covFalse  // XMLTransform
    );  // Close Open parameters


docObj.AttachDispatch(pIDoc); // Close AttachDispatch(…)

docObj.Activate();

docObj.Select();

CSelection selObj(appObj.get_Selection());

CString docText = selObj.get_Text();

docObj.Close(covOptional, covOptional, covOptional);

docsObj.Close(covOptional, covOptional, covOptional);

appObj.Quit(covOptional, covOptional, covOptional);


modified on Friday, July 9, 2010 8:48 AM

AnswerRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
Niklas L9-Jul-10 1:42
Niklas L9-Jul-10 1:42 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
m_code9-Jul-10 2:07
m_code9-Jul-10 2:07 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
Niklas L9-Jul-10 2:24
Niklas L9-Jul-10 2:24 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
m_code9-Jul-10 2:48
m_code9-Jul-10 2:48 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
Niklas L9-Jul-10 3:14
Niklas L9-Jul-10 3:14 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
m_code9-Jul-10 5:20
m_code9-Jul-10 5:20 
QuestionFile Mapping Pin
john56328-Jul-10 22:31
john56328-Jul-10 22:31 
AnswerRe: File Mapping Pin
Niklas L8-Jul-10 22:37
Niklas L8-Jul-10 22:37 
GeneralRe: File Mapping Pin
john56328-Jul-10 23:10
john56328-Jul-10 23:10 
GeneralRe: File Mapping Pin
Niklas L9-Jul-10 1:52
Niklas L9-Jul-10 1:52 
AnswerRe: File Mapping Pin
KarstenK8-Jul-10 22:50
mveKarstenK8-Jul-10 22:50 
AnswerRe: File Mapping Pin
Aescleal8-Jul-10 23:40
Aescleal8-Jul-10 23:40 
QuestionHow to resize a dialogbar Pin
ilgale8-Jul-10 21:27
ilgale8-Jul-10 21:27 
QuestionListBox Pin
AbhiHcl8-Jul-10 20:57
AbhiHcl8-Jul-10 20:57 
AnswerRe: ListBox Pin
MsmVc8-Jul-10 21:17
MsmVc8-Jul-10 21:17 
GeneralRe: ListBox Pin
AbhiHcl8-Jul-10 21:31
AbhiHcl8-Jul-10 21:31 
GeneralRe: ListBox Pin
Niklas L8-Jul-10 22:28
Niklas L8-Jul-10 22:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.