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

Discussion in 'C++' started by Reji, Mar 24, 2006.

  1. Reji

    Reji Guest

    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
     
    Reji, Mar 24, 2006
    #1
    1. Advertising

  2. Reji

    Ian Collins Guest

    Reji wrote:
    > 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.


    --
    Ian Collins.
     
    Ian Collins, Mar 24, 2006
    #2
    1. Advertising

  3. Reji

    Reji Guest

    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
     
    Reji, Mar 24, 2006
    #3
  4. Reji

    Ian Collins Guest

    Reji wrote:
    > 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++.

    --
    Ian Collins.
     
    Ian Collins, Mar 24, 2006
    #4
  5. Reji

    jimmy Guest

    Ian Collins 写é“:

    > Reji wrote:
    > > 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++.
    >
    > --
    > Ian Collins.


    If u can help, then do it anyway
     
    jimmy, Mar 24, 2006
    #5
  6. Reji

    Ian Collins Guest

    jimmy wrote:
    > Ian Collins 写é“:
    >
    >
    >>Reji wrote:
    >>
    >>>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++.
    >>
    >>--
    >>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.

    --
    Ian Collins.
     
    Ian Collins, Mar 24, 2006
    #6
  7. Reji

    Ben Pope Guest

    jimmy wrote:
    > Ian Collins 写é“:
    >
    >> Reji wrote:
    >>> 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++.
    >>
    >> --
    >> 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
    --
    I'm not just a number. To many, I'm known as a string...
     
    Ben Pope, Mar 24, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Wallace
    Replies:
    0
    Views:
    496
    John Wallace
    Jul 22, 2003
  2. Stephen Witter

    opening a word doc in word not browser

    Stephen Witter, May 18, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    526
    Stephen Witter
    May 18, 2004
  3. Sharon
    Replies:
    0
    Views:
    632
    Sharon
    Jul 27, 2005
  4. Matt
    Replies:
    3
    Views:
    549
    Tor Iver Wilhelmsen
    Sep 17, 2004
  5. John Salerno
    Replies:
    0
    Views:
    56
    John Salerno
    Apr 26, 2014
Loading...

Share This Page