|
-
February 5th, 2008, 10:31 PM
#1
Keep application forms on top
I want to keep the forms related to my forms on top of all other open applications. How do I do that? Thanks?
-
February 6th, 2008, 03:46 AM
#2
Re: Keep application forms on top
Forms related to your Forms?? 
Forms have a property called TopMost that can be set to true or false. Look at MSDN for more
-
February 8th, 2008, 07:54 AM
#3
Re: Keep application forms on top
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.
-
February 8th, 2008, 08:22 AM
#4
Re: Keep application forms on top
I presume Form.TopMost is the same we had to achieve with an API call in VB6
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
FormX.hWnd being the window handle of the app's Form.
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|