🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: be.comp.programming
Article #15244

Re: vb always on top

#15244
From: Gerbert
Date: Fri, 27 Oct 2000 19:54
48 lines
2534 bytes
"ViPeR" <no#tdc@lomag.net#spam> schreef in bericht
news:h_jK5.11796$Yq.270980@afrodite.telenet-ops.be...
> hoe krijg ik men proggie to be always on top??

Zet de volgende code in een module:

-----------------------
Option Explicit
Option Private Module

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
Public Const HWND_NOTOPMOST = -2
Public Const HWND_TOPMOST = -1
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const Flags = SWP_NOMOVE Or SWP_NOSIZE

Public Sub OnTop(FormName As Form)
  'Make a form always ontop of other windows
  On Error GoTo error
  Call SetWindowPos(FormName.hWnd, HWND_TOPMOST, 0&, 0&, 0&, 0&, Flags)
  Exit Sub
error:  MsgBox Err.Description, vbExclamation, "Error"
End Sub

Public Sub NotOnTop(FormName As Form)
  'Make a form not always ontop of other windows
  On Error GoTo error
  Call SetWindowPos(FormName.hWnd, HWND_NOTOPMOST, 0&, 0&, 0&, 0&, Flags)
  Exit Sub
error:  MsgBox Err.Description, vbExclamation, "Error"
End Sub
-----------------------

en roep die aan door:

Call OnTop(Me)

en je kunt het weer ongedaan maken door:

Call NotOnTop(Me)


Groeten,

Gerbert / http://gerbert.paanstra.nl/
Technical Details
Message-ID: <8tcmev$ngl$1@cyan.nl.gxn.net>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!europa.netcrusader.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!newsfeed.icl.net!newsfeeds.belnet.be!news.belnet.be!transit.news.xs4all.nl!blue.nl.gxn.net!cyan.nl.gxn.net!not-for-mail
References: <h_jK5.11796$Yq.270980@afrodite.telenet-ops.be>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 107324,afeccc0248c5b206
X-Google-Attributes: gid107324,public
X-Google-Thread: fcea4,afeccc0248c5b206
X-Google-Attributes: gidfcea4,public
X-Google-ArrivalTime: 2000-10-27 12:53:06 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!europa.netcrusader.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!newsfeed.icl.net!newsfeeds.belnet.be!news.belnet.be!transit.news.xs4all.nl!blue.nl.gxn.net!cyan.nl.gxn.net!not-for-mail
From: "Gerbert" <m4gerbert@hotmail.com>
Newsgroups: be.comp.programming,nl.comp.programmeren
Subject: Re: vb always on top
Date: Fri, 27 Oct 2000 21:54:24 +0200
Organization: FreeSurf
Lines: 50
Message-ID: <8tcmev$ngl$1@cyan.nl.gxn.net>
References: <h_jK5.11796$Yq.270980@afrodite.telenet-ops.be>
NNTP-Posting-Host: ap01-d11-049.dial.freesurf.nl
X-Trace: cyan.nl.gxn.net 972676383 24085 62.100.10.49 (27 Oct 2000 19:53:03 GMT)
X-Complaints-To: abuse@nl.gxn.net
NNTP-Posting-Date: 27 Oct 2000 19:53:03 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400