Regaining focus after RUNWIN (OpenInsight 16-Bit Specific)
At 05 AUG 2002 05:40:43AM Godfrey Farrugia wrote:
I have searched on this site for an answer to my query and although some leads looked promising, I couldn't find a satisfactory one. I have attempted various alternatives with no success. My query is this:
Launching MS-Word via Utility("RUNWIN", cmd, -1), on returning back, unless I move the mouse, nothing happens. How can I get the window that initiated the RUNWIN command to regain focus without having to move the mouse?
At 05 AUG 2002 08:32AM Oystein Reigem wrote:
Godfrey,
I did a test with OI 3.7.1 on Win XP and agree it's like you say.
My immediate thought was that you could solve the problem by setting the focus to the window after the call to Utility RUNWIN. But this doesn't work.
I might have found the explanation in some postings that say that the execution just runs ahead and doesn't wait for the modal window (Word) to finish. The app window waits all right, but not the handler. So I assume the Set_Property "FOCUS" instruction executes too early.
If this is the case you might try to get the handler to run until Word is finished. Use a loop that checks if Word is still there. But perhaps there will be problems if you have additional Word instances or documents running.
Or you might consider converting to OI32. I did a test in OI 4.0.3 and focus returns to the app window just fine.
Btw - there are a few variations on how to run a program from OI. I haven't tried them all.
- Oystein -
At 06 AUG 2002 09:12AM Matt Sorrell wrote:
Godfrey,
For what it's worth, my company used to run a 16-bit windows payroll application that exhibited some of the same behaviour you are seeing with OI-16.
My guess is that it is the way the window services the message queue and there is not really anything you can do about it, except upgrade to OI-32.
msorrel@greyhound.com