MS Word, C$SLEEP and accept
We have a problem associated with multiple ActiveX Word objects. We use MS Word to allow our users to create new letters or display existing ones. We do this by setting up the appropriate document and then passing control to MS Word. In the event paragraph which we use we look for the @ApplicationQuit event and once detected we set a flag. Meanwhile the program is sat in a loop (accept omitted before 100) waiting for the flag to be set so that we know that Word has finished. If the user has two versions of the program running (different threads from the same parent program - a main menu if you will) and each has a version of Word open then when one is closed the other one hangs. I have spent the last few days expermineting and have discovered that the root cause of this problem is the accept in the wait loop. So I changed it to a C$SLEEP. This solved the problem, however, now, sometimes?!?! MS Word doesn't start up correctly and hangs both itself and the AcuCobol application.
Does anyone have any ideas what to do about this? (other than going to Microsoft's office and shooting everyone)