|
-
Mar 27th, 2001, 01:15 PM
#1
Thread Starter
Fanatic Member
How can I make my form be on top at all time?
-
Mar 27th, 2001, 01:18 PM
#2
_______
<?>
Code:
'To make form stay topmost using API
'put this in a bas module
'
Public 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
Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
'=============================================
'
'put this in events click or load or whatever
'or hardcopy
'To set Form1 as a TopMost form, do the following:
res& = SetWindowPos (Form1.hWnd, HWND_TOPMOST, _
0, 0, 0, 0, FLAGS)
'if res&=0, there is an error
'To turn off topmost (make the form act normal again):
res& = SetWindowPos (Form1.hWnd, HWND_NOTOPMOST, _
0, 0, 0, 0, FLAGS)
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Mar 27th, 2001, 03:57 PM
#3
A bit of a shorter version:
Code:
Private Declare Function SetWindowPos _
Lib "user32" Alias "SetWindowPos" (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
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
|