|
-
Jan 5th, 2002, 10:26 AM
#1
Thread Starter
Lively Member
form to top
how do I make a form that stays allways on top?
VIP
-
Jan 5th, 2002, 08:27 PM
#2
VB Code:
Private Declare Function 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) As Long
Private Const SWP_NOMOVE = 2
Private Const SWP_NOSIZE = 1
Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) As Long
On Error Goto ErrRtn
If (Topmost) Then
SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
Else
SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
SetTopMostWindow = False
End If
Exit Function
ErrRtn:
MsgBox "Error in SetTopMostWindow " & Err & " " & Error, vbExclamation + vbOKCancel
End Function
'In Form Load Event, put...
'To Make Always On Top
SetTopMostWindow Me.hwnd, TRUE
'(SetTopMostWindow Me.hwnd, FALSE would prevent window from being TopMost)
-
Jan 5th, 2002, 10:46 PM
#3
New Member
on top form
I recall seeing this answered @ www.vbcode.com
To search their data base, simply
Enter an exact search string "on top"
You should get several techniques, some using code, some
using properties
-
Jan 6th, 2002, 08:31 AM
#4
Thread Starter
Lively Member
-
Jan 6th, 2002, 04:21 PM
#5
To make a Form stay on top:
VB Code:
Private Declare Function 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) As Long
Private Sub Form_Load()
SetWindowPos hwnd, -1, 0, 0, 0, 0, 3
End Sub
-
Jan 7th, 2002, 01:46 AM
#6
Thread Starter
Lively Member
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
|