🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.basic.visual.misc
4 messages
4 total messages Started by Marc Alcide Thu, 08 Oct 1998 00:00
Help, I want my form ALWAYS staying on top of ANY other window
#264
Author: Marc Alcide
Date: Thu, 08 Oct 1998 00:00
40 lines
1517 bytes
This is a multi-part message in MIME format.
--------------0C1D3B7B56CA867369DF86FB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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





--------------0C1D3B7B56CA867369DF86FB
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Marc  Alcide
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             Marc  Alcide
n:              Alcide;Marc 
email;internet: marc.alcide@advalvas.be
note:           Mobile: 075/86.46.79
x-mozilla-cpt:  ;0
x-mozilla-html: FALSE
version:        2.1
end:            vcard


--------------0C1D3B7B56CA867369DF86FB--
Re: Help, I want my form ALWAYS staying on top of ANY other window
#265
Author: sheppe
Date: Thu, 08 Oct 1998 00:00
62 lines
2853 bytes
In article <361CB6BD.50185564@advalvas.be>,
  Marc Alcide <marc.alcide@advalvas.be> wrote:
> This is a multi-part message in MIME format.
> --------------0C1D3B7B56CA867369DF86FB
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> 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)

In a module, place the following code

'this is the function used to manipulate the window position
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

'several constants that are used in conjunction with that function (hehe, that
'rymes) ;)
Public Const SWP_FRAMECHANGED = &H20 ' The frame changed: send WM_NCCALCSIZE
Public Const SWP_DRAWFRAME = SWP_FRAMECHANGED
Public Const SWP_HIDEWINDOW = &H80
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_NOCOPYBITS = &H100
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOOWNERZORDER = &H200 ' Don't do owner Z ordering
Public Const SWP_NOREDRAW = &H8
Public Const SWP_NOREPOSITION = SWP_NOOWNERZORDER
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOZORDER = &H4
Public Const SWP_SHOWWINDOW = &H40
Public Const HWND_BOTTOM = 1
Public Const HWND_TOP = 0
Public Const HWND_NOTOPMOST = -2
Public Const HWND_TOPMOST = -1

'and now in your form, usually in the form load event, enter the following:

Private Sub Form_Load()

    'a variable to hold the return value of the setwindowpos function
    Dim RetVal As Long
    'set the form as the topmost window
    RetVal = SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE Or _
    SWP_NOMOVE)
    'If RetVal <> 0 Then Success!
End Sub

--
Sheppe Pharis
VB5/ActiveX Developer
http://members.xoom.com/2mStn

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Re: Help, I want my form ALWAYS staying on top of ANY other window
#266
Author: 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       **
***************************************
Re: Help, I want my form ALWAYS staying on top of ANY other window
#267
Author: zarr
Date: Fri, 09 Oct 1998 00:00
53 lines
2145 bytes
Take a look at http://www.zarr.com/vb and under the source code page is an
example that will do it....

Zarr. ------- For the ultimate VB source code, news and articles, visit
http://www.zarr.com/vb




In article <361CB6BD.50185564@advalvas.be>,
  Marc Alcide <marc.alcide@advalvas.be> wrote:
> This is a multi-part message in MIME format.
> --------------0C1D3B7B56CA867369DF86FB
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> 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
>
> --------------0C1D3B7B56CA867369DF86FB
> Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
> Content-Transfer-Encoding: 7bit
> Content-Description: Card for Marc  Alcide
> Content-Disposition: attachment; filename="vcard.vcf"
>
> begin:          vcard
> fn:             Marc  Alcide
> n:              Alcide;Marc
> email;internet: marc.alcide@advalvas.be
> note:           Mobile: 075/86.46.79
> x-mozilla-cpt:  ;0
> x-mozilla-html: FALSE
> version:        2.1
> end:            vcard
>
> --------------0C1D3B7B56CA867369DF86FB--
>
>


--

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
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