|
-
Jan 21st, 2002, 06:05 AM
#1
Thread Starter
Lively Member
How do I make a form always on top of another?
The topic pretty much says it all, but I should clarify that I do NOT want the second form to be ontop of EVERYTHING, just the one other form.
--Anders
Reality is what you make up when you can't handle your fantasies.
-
Jan 21st, 2002, 06:37 AM
#2
Addicted Member
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Const SWP_NOSIZE = &H1
Const SWP_NOMOVE = &H2
Const SWP_NOACTIVATE = &H10
Const SWP_SHOWWINDOW = &H40
Private Declare Sub SetWindowPos Lib "User32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Sub Form_Load()
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub
Knowledge is static .... understanding is Dynamic
-
Jan 21st, 2002, 06:59 AM
#3
Thread Starter
Lively Member
Hmm, no I've tried that. This makes the form ontop of everything. I only want it ontop of the form that opens it.
--Anders
Reality is what you make up when you can't handle your fantasies.
-
Jan 21st, 2002, 07:01 AM
#4
VB Code:
'Form2 is the form being shown
'Form1 is the form it will stay on top of
Form2.Show , Form1
-
Jan 21st, 2002, 03:17 PM
#5
Member
SetWinword
See my question on Setwinword and Windows XP.
My problem is that this worked when I had win98 but i cant get it to work on win XP.
Let me know of your success.
PS I normally place the function call in the load procedure of the form that needs to be on top.
Hope this helps
-
Jan 21st, 2002, 03:18 PM
#6
Member
I just read tyger's reply i'm going to try that!
-
Jan 21st, 2002, 03:51 PM
#7
Member
yes tygur's suggestion works even in XP
how simple
Doh!!
Thanks very much!!!
-
Jan 21st, 2002, 04:35 PM
#8
Thread Starter
Lively Member
Ok, now I feel like an idiot. 
Thanks!
--Anders
Reality is what you make up when you can't handle your fantasies.
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
|