Open Application With ShellExecuteEx

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

Hello,
I have an issue and I don't know if this is the correct group to post
to. If it isn't, just tell me the correct group, and I will post there.
I wrote a Visual C++ application that will open a Word doc using
ShellExecuteEx based on the filename. When a user tries to close the
word doc it hangs and then gives a message which says "This application
is taking longer than expected to ..." . When a user opens Word
independently, then it can close normally. What would cause Word to
have this issue when being opened from ShellExecuteEx?

-Jay
(patelj27b at gmail dot com)
 
You may want to try to use the following flags with th fMask member of the
SHELLEXECUTEINFO structure:
SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT.

Using these flags will provide you with a handle to the launched process
which you can use with WaitForSingleObject to test for closure.

You are responsible for closing the process handle returned in the hProcess
structure member.
 
Have you tried just using ShellExecute() instead. I think that would work
for what you're trying to do since there is no connection needed between
your program and Word.

Tom
 
Back
Top