To avoid this message,disable the 'org.eclipse.recommenders.completion.rcp'plug-in or disable the 'J

https://blog.csdn.net/kuangniaokuang/article/details/79353407
阅读更多

Disable Word.Application error message in VC

11-07

Hi,rnrnFollowing code in a VC application use Word.Application to print out a document. But Winword will rise an error message if something is wrong in the document. I don't want the error message, since no body is waiting for clicking that OK button. Is it possible to disable that error message from Word.Application? By the way, is it possible to get the Process ID for the Word.Application, so I can kill it. Thanks.rnrn_Application l_wordApp;rnDocuments l_wordDocs;rn_Document l_wordDoc; rnrnl_wordDocs.ReleaseDispatch();rnl_wordDoc.ReleaseDispatch();rnl_wordApp.m_bAutoRelease=true;rnrnif(!l_wordApp.CreateDispatch("Word.Application")) rn rn AfxMessageBox("Create Word.Application instance error"); rn return; rnrnrnl_wordApp.SetVisible(FALSE);rnrnCOleVariant varFilePath("C:\\TEMP\\FP DS 11 09 03.doc");rnCOleVariant varstrNull("");rnCOleVariant varZero((short)0);rnCOleVariant varTrue(short(1),VT_BOOL);rnCOleVariant varFalse(short(0),VT_BOOL);rnrnl_wordDocs.AttachDispatch(l_wordApp.GetDocuments());rnl_wordDocs.Open(varFilePath,rn varFalse,rn varTrue,rn varFalse,rn varstrNull,rn varstrNull,rn varFalse,rn varstrNull,rn varstrNull,rn varTrue,rn varTrue,rn varTrue);rnl_wordDoc.AttachDispatch(l_wordApp.GetActiveDocument()); rnrn//l_wordApp.SetActivePrinter(lpszActivePrinter); rnrnCOleVariant covTrue((short)TRUE), rn covFalse((short)FALSE), rn covOptional((long)DISP_E_PARAMNOTFOUND, rn VT_ERROR); rnrntry rn l_wordDoc.PrintOut(covFalse, // It will rise errorrn covOptional, rn covOptional, rn covOptional, rn covOptional, rn covOptional, rn covOptional, rn COleVariant((long)1), rn covOptional, rn covOptional, rn covOptional, rn covOptional, rn covOptional, rn covOptional, rn covOptional, rn covOptional, rn covOptional, rn covOptional); rn catch (...) rnrntry rn l_wordApp.Quit(covOptional,covOptional,covOptional);rn catch (...) rnrnl_wordDoc.ReleaseDispatch(); rnl_wordDocs.ReleaseDispatch();rnl_wordApp.ReleaseDispatch();rn

没有更多推荐了,返回首页