I have an MFC application that opens up a Word document for editing using automation. Is there a way to pause or freeze the MFC application while the Word doc is being edited? After the editing is done and Word is closed, I want the MFC application to regain control and continue with doing something else. It's kind of like having it take a break until Microsoft Word is closed.
How can this be implemented?
2 1832
Edit your Word document on a separate thread by calling CreateThread().
Use the HANDLE returned by CreaateThread() as an argument to WaitForSingleObject().
When WaitForSingleObject() returns, the thread is gone meaning your edit is complete.
I've never heard of this before...could you please show me an example of how to implement that with my code which uses Automation? - _Application wordAppLib;
-
CString id("Word.Application");
-
BOOL status = wordAppLib.CreateDispatch(id);
-
-
_Document myDoc;
-
COleVariant covTrue((short)TRUE);
-
COleVariant covFalse((short)FALSE);
-
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
-
Documents docs = wordAppLib.GetDocuments();
-
CString ReportFileName(_T("C:\\Documents and Settings\\Sleep\\Desktop\\CPFTool Project\\CPFTool\\CPFTool\\Library.doc"));
-
myDoc = docs.Open(COleVariant(ReportFileName),
-
covOptional,
-
covFalse, // ReadOnly
-
covOptional,
-
covOptional,
-
covOptional,
-
covOptional,
-
covOptional,
-
covOptional,
-
covOptional,
-
covOptional,
-
covOptional);
-
-
-
wordAppLib.Resize((GetSystemMetrics(SM_CXSCREEN) * 0.375), GetSystemMetrics(SM_CYSCREEN));
-
wordAppLib.Move(dtRect.left, dtRect.top);
-
wordAppLib.SetVisible(TRUE);
-
wordAppLib.Activate();
-
-
-
_Application wordAppBlank;
-
CString idBlank("Word.Application");
-
BOOL statusBlank = wordAppBlank.CreateDispatch(idBlank);
-
-
_Document myDocBlank;
-
-
Documents docsBlank = wordAppBlank.GetDocuments();
-
myDocBlank = docsBlank.Add(covOptional,covOptional,covOptional,covOptional);
-
-
wordAppBlank.Resize((GetSystemMetrics(SM_CXSCREEN) * 0.375), GetSystemMetrics(SM_CYSCREEN));
-
wordAppBlank.Move(((GetSystemMetrics(SM_CXSCREEN) * 0.375) + 1), 0);
-
wordAppBlank.SetVisible(TRUE);
-
wordAppBlank.Activate();
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Henry |
last post by:
I am writing a Windows forms VB.Net/MS SQL application via VS 2003 that
utilizes Crystal Reports. I want to be able to dynamically set the
report data source at run time.
I'm trying to change...
|
by: Jon Davis |
last post by:
Can a solution built in C# utilize MSMQ and/or MTS?
If so, does this make the training material I already have on MSMQ and MTS
in the context of VB6 an appropriate prerequisite foundation before...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |