Thread View: comp.lang.visual.basic
2 messages
2 total messages
Started by Jason Kohlhagen
Thu, 05 Feb 1998 00:00
Always on Top
Author: Jason Kohlhagen
Date: Thu, 05 Feb 1998 00:00
Date: Thu, 05 Feb 1998 00:00
4 lines
949 bytes
949 bytes
I'm writing a little menu for my computer and want it to always stay on top. However I can't find the code or instructions on how to do that anywhere. Would someone be able to help me please ? :)
Re: Always on Top
Author: Bryan Elder
Date: Thu, 05 Feb 1998 00:00
Date: Thu, 05 Feb 1998 00:00
38 lines
1858 bytes
1858 bytes
You need to call the SetWindowPos API. I have a routine called AlwaysOnTop
that I pass the hWnd of the form and a value of true or false to determine
whether it should be on top or not.
Declare Function SetWindowPos Lib "user" (ByVal h%, ByVal hb%, ByVal X%,
ByVal Y%, ByVal cx%, ByVal cy%, ByVal f%) As Integer
Sub AlwaysOnTop (ByVal hWnd As Integer, OnTop As Integer)
Const SWP_NOMOVE = 2
Const SWP_NOSIZE = 1
Const Flags = SWP_NOMOVE Or SWP_NOSIZE
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Dim rc As Integer
If OnTop Then
rc = SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, Flags) '
Returns <> 0 on success
Else
rc = SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, Flags)
End If
End Sub
Bryan Elder
Jason Kohlhagen <hagen@fullcomp.com.au> wrote in article
<6bb8k6$r4l$1@demeter.omen.com.au>...
> I'm writing a little menu for my computer and want it to always stay on
top.
> However I can't find the code or instructions on how to do that anywhere.
> Would someone be able to help me please ? :)
>
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads