I recently programmed one main application calling another one, I considered the separation because in a separate test project a new form with web browser control worked, while it failed in the environment of the main application/project. I'm still not sure why, some setting, but also likely a timer and what it does and the VFX framework used.
I also found out the web browser control events only happen, when it's visible including the form it's on.
The best way to avoid minimize/maximize I found out was to shift the inactive _screen left of the display (negative left coordinate). I didn't do that with BindEvents to _screen activate/deactivate at all. One button in the main app causes switching to the other process/_screen and closing that form reactivates the main app. It's not always applicable, as you might have to do with a multi-display environment and then a screen translated to negative coordinates can be visible on a left display, if the main display is the right one instead of the normal setup.
I did the second application as OlePublic class and that caused some trouble with events. If you look at the last three or four threads I started they are about different problems all related to this scenario.
In my case _vfp.ole... properties helped and as I said in one of the threads starting a timer that executed an action/event later after the method already returned to the caller helped to prevent a deadlock in the windows events queue (I guess). In short: decoupling.
I don't know what's the second application in your case, likely candidates are Office applications you control via ole automation, then _vfp.ole... properties may apply, though that applied to the ole application I did myself, but also the main app (client) has the _vfp.olerequestpendingtimeout property.
All in all, I know have a nice framework of creating automatable applications quite like office applications are.
Aside from that, I remember how BindEvents to windows messages was a solution to application activation/deactivation events. See
especially binding to WM_ACTIVATE.
Bye, Olaf.
Olaf Doschke Software Engineering