Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Database Pin
David Crow3-Aug-06 2:34
David Crow3-Aug-06 2:34 
QuestionAGAIN !!! Sory but i dont find my thread ! to write ! Pin
Bravoone_20063-Aug-06 1:44
Bravoone_20063-Aug-06 1:44 
AnswerRe: AGAIN !!! Sory but i dont find my thread ! to write ! Pin
Viorel.3-Aug-06 2:09
Viorel.3-Aug-06 2:09 
GeneralRe: AGAIN !!! Sory but i dont find my thread ! to write ! Pin
Bravoone_20063-Aug-06 2:24
Bravoone_20063-Aug-06 2:24 
QuestionRe: AGAIN !!! Sory but i dont find my thread ! to write ! Pin
David Crow3-Aug-06 2:43
David Crow3-Aug-06 2:43 
AnswerRe: AGAIN !!! Sory but i dont find my thread ! to write ! Pin
Bravoone_20063-Aug-06 3:08
Bravoone_20063-Aug-06 3:08 
QuestionRe: AGAIN !!! Sory but i dont find my thread ! to write ! Pin
Bravoone_20063-Aug-06 2:47
Bravoone_20063-Aug-06 2:47 
QuestionProblems in Closing Document objects in Automated MSWord using VC++ [modified] Pin
georgekjolly3-Aug-06 1:22
georgekjolly3-Aug-06 1:22 
Hi All,

I have automated MSWord in VC++ and open an *.doc file and save it as a text file with the help of CodeProject. But I am getting Run time errors while I am try to close my application and documents .

*The error is

"Application has requested Run time to Terminate it in an unusual way"

My Code starts here

BOOL CLastApp::InitInstance()
{
if(!AfxOleInit()) // Your addition starts here
{
AfxMessageBox("Could not initialize COM dll");
return FALSE;
}
else
{
AfxMessageBox("Inint");
}
_Application app; // app is the Excel _Application object

if(!app.CreateDispatch("Word.Application"))
{
AfxMessageBox("Couldn't start Word");
}
else
{
//Make Word Visible and display a message
app.SetVisible(TRUE);
AfxMessageBox ("Word is Running!");
}

COleVariant

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


Documents docs = app.GetDocuments();

_Document doc = docs.Open(
COleVariant("D:\\ss.doc"),
covTrue, // Confirm Conversion.
covTrue, // ReadOnly.
covFalse, // AddToRecentFiles.
covOptional, // PasswordDocument.
covOptional, // PasswordTemplate.
covFalse, // Revert.
covOptional, // WritePasswordDocument.
covOptional, // WritePasswordTemplate.
covTrue,
covTrue,
covOptional,
covOptional,
covOptional,
covOptional);


doc.SaveAs(COleVariant("D:\\george\\win.txt"),
covFormat,covOptional,covOptional,
covOptional,covOptional,covFalse,covOptional,
covTrue,covFalse,covOptional, covOptional,covTrue,covOptional,covOptional,covOptional);


/**********IT IS WORKING UPTO HERE PROPERLY ************************/

//**********PROBLEM STARTS FROM HERE****************************//

doc.Close(covOptional,covOptional,covOptional);
docs.Close(covOptional,covOptional,covOptional); /*Error is coming from here if we comment it no error will come */
app.Quit();

}
//Programme Ends here

While am trying to close doc or docs its getting run time error. How I can properly Execute these statements.


Please help me
Thanks in Advance
George K Jolly





-- modified at 10:39 Thursday 3rd August, 2006
QuestionRe: Problems in Closing Document objects in Automated MSWord using VC++ Pin
David Crow3-Aug-06 2:47
David Crow3-Aug-06 2:47 
QuestionVS 2005 Installer Pin
Programm3r3-Aug-06 1:22
Programm3r3-Aug-06 1:22 
AnswerRe: VS 2005 Installer Pin
Sarath C3-Aug-06 1:37
Sarath C3-Aug-06 1:37 
QuestionRe: VS 2005 Installer Pin
Programm3r3-Aug-06 1:47
Programm3r3-Aug-06 1:47 
AnswerRe: VS 2005 Installer Pin
Sarath C3-Aug-06 1:50
Sarath C3-Aug-06 1:50 
GeneralRe: VS 2005 Installer Pin
Programm3r3-Aug-06 1:58
Programm3r3-Aug-06 1:58 
GeneralRe: VS 2005 Installer Pin
Sarath C3-Aug-06 2:00
Sarath C3-Aug-06 2:00 
GeneralRe: VS 2005 Installer Pin
Programm3r3-Aug-06 2:01
Programm3r3-Aug-06 2:01 
AnswerRe: VS 2005 Installer Pin
Neil Van Eps3-Aug-06 6:01
Neil Van Eps3-Aug-06 6:01 
Questioncannot open file "mfc42u.lib" Pin
akshita_153-Aug-06 1:12
akshita_153-Aug-06 1:12 
AnswerRe: cannot open file "mfc42u.lib" Pin
Bravoone_20063-Aug-06 1:19
Bravoone_20063-Aug-06 1:19 
QuestionRe: cannot open file "mfc42u.lib" Pin
Programm3r3-Aug-06 1:20
Programm3r3-Aug-06 1:20 
QuestionRe: cannot open file "mfc42u.lib" Pin
Hamid_RT3-Aug-06 1:34
Hamid_RT3-Aug-06 1:34 
AnswerRe: cannot open file "mfc42u.lib" Pin
Hamid_RT3-Aug-06 1:34
Hamid_RT3-Aug-06 1:34 
AnswerRe: cannot open file "mfc42u.lib" Pin
Sarath C3-Aug-06 1:48
Sarath C3-Aug-06 1:48 
QuestionTHANKS BUT IS NOT WORKING SOMETHING IS WRONG !!!! I DON'T NO WHAT !!!!! Pin
Bravoone_20063-Aug-06 1:10
Bravoone_20063-Aug-06 1:10 
QuestionRe: THANKS BUT IS NOT WORKING SOMETHING IS WRONG !!!! I DON'T NO WHAT !!!!! Pin
Hamid_RT3-Aug-06 1:31
Hamid_RT3-Aug-06 1:31 

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.