views:

160

answers:

0

This problem is related to the Evil delay question, except that my delay is not in launching the application but in waiting for ShellExecute to return.
I have a small dialog application (Win32, written in VC++ 6, running on WinXP) that spawns a worker thread which writes to a logging text file. The thread exchanges information with the main dialog, which Raymond says will use a hidden window.

However, I disable my dialog (just refreshing it with progress details) until the worker thread has terminated. Only then is the user able to click on the "inspect log" button which calls ShellExecute to display the log file. The application (TextPad) that opens the text file uses DDE so that if an instance is already running, it simply opens the file in that one. I then find that I can't close my application until I close TextPad.

Is it possible that I still have a hidden window that doesn't respond to the initial DDE broadcast message, even though my thread has terminated? I've read the warning about CoInitialize in Raymond's piece, and I don't call that function explicitly.

Can anyone suggest how I should proceed?