Article View: comp.lang.visual.basic
Article #28Re: Always on Top
From: 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 ? :)
>
>
>
Technical Details
Message-ID:
<6bctqv$c7t$1@gte1.gte.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6bb8k6$r4l$1@demeter.omen.com.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1053fc,42c0a2c704b69110 X-Google-Attributes: gid1053fc,public X-Google-Thread: 105c2e,42c0a2c704b69110 X-Google-Attributes: gid105c2e,public X-Google-Thread: 10b997,42c0a2c704b69110 X-Google-Attributes: gid10b997,public X-Google-Thread: fb992,42c0a2c704b69110 X-Google-Attributes: gidfb992,public From: "Bryan Elder" <bryane@pioneernet.net> Subject: Re: Always on Top Date: 1998/02/05 Message-ID: <6bctqv$c7t$1@gte1.gte.net> X-Deja-AN: 322362899 References: <6bb8k6$r4l$1@demeter.omen.com.au> Organization: gte.net X-Auth: UNKNOWN@m5.pioneernet.net Newsgroups: comp.lang.visual.basic,es.comp.lenguajes.visual-basic,fj.lang.visualbasic,it.comp.lang.visual-basic