I want to keep the forms related to my forms on top of all other open applications. How do I do that? Thanks?
Printable View
I want to keep the forms related to my forms on top of all other open applications. How do I do that? Thanks?
Forms related to your Forms?? :confused:
Forms have a property called TopMost that can be set to true or false. Look at MSDN for more
Shuja:
I had tried that. That has no effect. I have a non-.Net, third-party application running with its form taking up the whole screen. Now, I want to run my application so that its form shows up above the first application and remains there even when I shift control to the first application. Is that possible? I am using VS 2003. Thanks.
I presume Form.TopMost is the same we had to achieve with an API call in VB6
FormX.hWnd being the window handle of the app's Form.Code:Public Declare Function SetWindowPos Lib "user32" ( _
ByVal hWnd As Long, _
ByVal hWia As Long, _
ByVal X As Long, ByVal Y As Long, _
ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long _
) As Long
Public Const SWP_NoSize = 1&
Public Const SWP_NoMove = 2&
Public Const HWND_TopMost = -1&
'the call:
SetWindowPos FormX.hWnd, HWND_TopMost, 0, 0, 0, 0, SWP_NoSize + SWP_NoMove
After calling the app's Form stays on top of all others.
Only, if another app does the same call it will take over the topmost position.
Maybe you can use a timer to set the TopMost property repeatedly every 500msec (either by API cal or by setting the Form's property)
Maybe that smartens out the other app.