|
-
July 31st, 2001, 09:40 AM
#1
Always on Top
Hi,
How can I make a form stay always on top ? (In similiar to Windows Clock utility).
Yaron.
-
July 31st, 2001, 09:51 AM
#2
Re: Always on Top
put this in a module..
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
'constants for SetWindowPos API
private Const SWP_NOMOVE = 2
private Const SWP_NOSIZE = 1
private Const HWND_TOPMOST = -1
private Const HWND_NOTOPMOST = -2
public Sub SetOnTop(byval hwnd as Long, byval bSetOnTop as Boolean)
Dim lR as Long
If bSetOnTop then
lR = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or _
SWP_NOSIZE)
else
lR = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or _
SWP_NOSIZE)
End If
End Sub
Then in your form load event..
private Sub Form_Load()
'keep form on top of everything
SetOnTop me.hwnd, true
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
|