🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.basic.visual.misc
Article #266

Re: Help, I want my form ALWAYS staying on top of ANY other window

#266
From: Peter Denton
Date: Thu, 08 Oct 1998 00:00
39 lines
1855 bytes
Marc Alcide wrote:
> 
> Hi,
> 
> I want my form always staying on top of any other window
> 
> How do I do that.?
> 
> Is there a property that does the job?
> 
> (WIN 98-VB 5.0)
> 
> Email please

You need to use the Windows API - VB does not have it's own method to
perform this operation.  You need to use the SetWindowPos function in
User32.dll.  To use this you need the following code in the General
Declarations section of your form (all on one line - omit the private if
placed in a code module) 

	Private Declare Function SetWindowPos Lib "user32" (ByVal h As Long,
ByVal hb%, ByVal x%, ByVal y%, ByVal cx%, ByVal cy%, ByVal f%) As
Integer

Place the following code in Form_Load (Replace Me with the name of your
form if making it always on top from another form/module):

	Dim ret As Integer
	ret = SetWindowPos(Me.hWnd, -1, 0, 0, 0, 0, 2 Or 1)

Hope this helps.

-- 
***************************************
**    EMail Sent By Peter Denton     **
** Email: P.G.Denton@scm.brad.ac.uk  **
**    OR  P.G.Denton@bradford.ac.uk  **
**       Phone: (01274) 232559       **
***************************************
Technical Details
Message-ID: <361CDDFB.26342B11@scm.brad.ac.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <361CB6BD.50185564@advalvas.be>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 110e3b,537b9fb8f551a378
X-Google-Attributes: gid110e3b,public
X-Google-Thread: 111c4c,537b9fb8f551a378
X-Google-Attributes: gid111c4c,public
From: Peter Denton <P.G.Denton@scm.brad.ac.uk>
Subject: Re: Help, I want my form ALWAYS staying on top of ANY other window
Date: 1998/10/08
Message-ID: <361CDDFB.26342B11@scm.brad.ac.uk>
X-Deja-AN: 399031126
Content-Transfer-Encoding: 7bit
References: <361CB6BD.50185564@advalvas.be>
To: marc.alcide@advalvas.be
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: University of Bradford
Mime-Version: 1.0
Newsgroups: comp.lang.basic.visual.misc,be.comp