mickeyfeldman
Programmer
Guarantee and reliable StayOnTop ?
The Delphi docs recommend against changing the formstyle while a program is running.
My application (App A) communicates with another application (App B) on the same PC via TCP. I do not have access to the source for App B. App A generally appears as a wide control and menu bar at the top of the screen and stays on top of App B. When App A passes control to App B, App A hides; when App A receives a message from App B it makes itself visible again. So far, no problem.
App A also receives data input from an external device (serial port) at arbitrary times. A user may be in attendance or the process may run automatically. When external data is received, other forms are launched by App A for the benefit of the possible user. If there is a user, and if that user clicks on App B, App A becomes inactive but Stays On Top as intended. By setting the formstyle of all my forms to fsStayOnTop, and resetting this property in my main form Activate and DeActivate events, I can generally get 90% of the behavior I'm looking for.
However, 1) Trying to set formstyle in the OnResize event causes App A to disappear entirely but continue running as a process visible only in the Windows Task Manager, which must be used to kill it. 2) if the user minimizes App A, it then loses its StayOnTopness until it is closed and restarted. 3) I had a button which iconized App A to the tool bar using Shell_NotifyIcon, and which worked correctly before I tried to force App A to stay on top. This now causes App A to place its icon in the system tray, after which the icon promptly disappears and only the Task Manager accessible process is available.
Is there a straightforward (or hey, any) way to force App A to always be on top except when it is minimized intentionally by the user or hidden entirely under program control, to maintain this behavior regardless of what actions the user may take, regardless of whether it displays forms other than its main form, and regardless of which App has focus?
Thanks for any answers
The Delphi docs recommend against changing the formstyle while a program is running.
My application (App A) communicates with another application (App B) on the same PC via TCP. I do not have access to the source for App B. App A generally appears as a wide control and menu bar at the top of the screen and stays on top of App B. When App A passes control to App B, App A hides; when App A receives a message from App B it makes itself visible again. So far, no problem.
App A also receives data input from an external device (serial port) at arbitrary times. A user may be in attendance or the process may run automatically. When external data is received, other forms are launched by App A for the benefit of the possible user. If there is a user, and if that user clicks on App B, App A becomes inactive but Stays On Top as intended. By setting the formstyle of all my forms to fsStayOnTop, and resetting this property in my main form Activate and DeActivate events, I can generally get 90% of the behavior I'm looking for.
However, 1) Trying to set formstyle in the OnResize event causes App A to disappear entirely but continue running as a process visible only in the Windows Task Manager, which must be used to kill it. 2) if the user minimizes App A, it then loses its StayOnTopness until it is closed and restarted. 3) I had a button which iconized App A to the tool bar using Shell_NotifyIcon, and which worked correctly before I tried to force App A to stay on top. This now causes App A to place its icon in the system tray, after which the icon promptly disappears and only the Task Manager accessible process is available.
Is there a straightforward (or hey, any) way to force App A to always be on top except when it is minimized intentionally by the user or hidden entirely under program control, to maintain this behavior regardless of what actions the user may take, regardless of whether it displays forms other than its main form, and regardless of which App has focus?
Thanks for any answers