Hi Jack,
I believe that you can do what you want by using ShowWindow to first minimize, and then restore the window you wish to activate. See
Is there a better kludge for SetForegroundWindow (Thread 671245) for more about this. If there is a reasonable way to accomplish the sort of inter-process communication you allude to, I'd be interested to learn about it, but that is a much more general question.
Mike
>I have a button in FoxPro Task1 that launches FoxPro Task2 (separate executables). If the user returns to FoxPro Task1 while Task2 is waiting for events, and presses the button again, I want to "activate" Task2: that is, I want to bring Task2 to the top of the ZOrder and fire some event in Task2 (preferably the form's Activate event).
>
>I can use SetForegroundWindow() to bring the window to the top of the ZOrder, but no event is fired. Notably, if I use Alt-Tab to switch context between Task1 and Task2, no event fires in Task2. I suspect that if I solve the problem for Alt-Tab I will also have solved it for SetForegroundWindow().
>
>Is there a FoxPro event in the target window that fires when SetForegroundWindow() is executed? Alternatively, is there a way with VFP 7 that I can capture the apropriate Windows event?