Hi All,

It's long but it's an interesting problem.

I have a main application that starts another application to get some user input(sounds crazy I know but it's easier this way). To make it so the user can not use the main application until the new one is closed I bring up a dialog that has a cancel button on it. In theory if the second app became locked up or was having problems the user could click the Cancel button and it would call TerminateProcess. The problem is TerminateProcess is not the best way to exit. If the app isn't locked up I don't want it to close that way. What I want to do is send/post a message to the second app to tell it to close. If it can it will close and the main app will get notification that it closed and not call TerminateProcess. If after five seconds it has not received notification that it closed then I want to close it with TerminateProcess. I can't seem to find a way to do this. I send messages back and forth using WM_COPYDATA and use OnTimer as my timer. I need to post the initial message to close because if I call SendMessage and the other app is locked up then my main app will be locked up too. So I tried posting the message and then creating a timer but the second app never gets the posted message. So I tried posting the message to the second app and then posting a message to the main app to start the timer. Again the second app never got the message.

Has anyone ever tried something like this or have any ideas how I could do this?

Thanks in advance for any help.
-Ben