How to get Notifications when a word doc is modified and closed

R

Reji

Hi All,

I have an MFC dialog based application, where I can browse for files
and open them. For opening files I get the file path and use
ShellExecute(...). But with ShellExecute(...), i lose control over the
process. So I am now using FindExecutable(...) and CreateProcess(...).
Now I am able to wait till the notepad document or similiar ones get
closed. (I am using WaitForSingleObject(processInfo.hProcess,
INFINITE)).


Now I have 2 issues :
1. The same code does not seem to work for word docs. The
WaitForSingleObject(processInfo.hProcess, INFINITE), returns
immediately. It does not wait for the word doc to get closed. But the
same code works for notepad files.


2. Even if I wait, how can I find out if the file has been modified or
not? Basically , I want my MFC application to be notified if the file
that it opened was modified and the changes were
saved by the user. I tried using
GetExitCodeProcess(processInfo.hProcess, &dwExitCode), but will I know
if the file has been modified or not using the dwExitCode?


Please help me with this.


Thanks in advance,
Reji
 
I

Ian Collins

Reji said:
Hi All,

I have an MFC dialog based application, where I can browse for files
and open them. For opening files I get the file path and use
ShellExecute(...). But with ShellExecute(...), i lose control over the
process. So I am now using FindExecutable(...) and CreateProcess(...).
Now I am able to wait till the notepad document or similiar ones get
closed. (I am using WaitForSingleObject(processInfo.hProcess,
INFINITE)).
You will have better luck on a windows programming group, this isn't a
C++ issue.
 
R

Reji

Thanks Ian, But can i not use CreateProcess() and WaitForSingleObject
in a noraml C++ program? Forget the MFC application. How can I do it in
a C++ application?

Thanks in advance,
Reji
 
I

Ian Collins

Reji said:
Thanks Ian, But can i not use CreateProcess() and WaitForSingleObject
in a noraml C++ program? Forget the MFC application. How can I do it in
a C++ application?
I believe so, but they are windows functions, not part of standard C++.
 
I

Ian Collins

jimmy said:
Ian Collins 写é“:




If u can help, then do it anyway
Who's u?

This is a C++ Language group, not a windows programming one. There are
plenty of those.
 
B

Ben Pope

jimmy said:
Ian Collins 写é“:


If u can help, then do it anyway

He already did. He suggested "a windows programming group" since "this
isn't a C++ issue".

C++ does not have any native thread support, that support comes from an
OS, and is thus OS specific.

Ben Pope
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top