Help: How to create a VB application that is always-on-top of all other windows? 
Author Message
 Help: How to create a VB application that is always-on-top of all other windows?

Hello,

This VB application main window has higher priority than others. Even you
focus on other opened windows, this VB application is still on the top and
keep running. I have seen some windows applications like this, I would like
to know if this can be done in VB, and how?

a T d H v A a N n K c S e
(Thanks in advance)

Jingbo Zheng



Wed, 25 Apr 2001 03:00:00 GMT  
 Help: How to create a VB application that is always-on-top of all other windows?
Jingbo,

To force the form to say on top, try the following code:

Option Explicit
Private 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

Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1

Private Sub Form_Activate()
  Dim lRet&

    lRet& = SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or
SWP_NOSIZE)
End Sub

To stop it being on top, send a SetWindowPos with an argument of
HWND_NOTOPMOST.

HTH

Peter

Quote:

>Hello,

>This VB application main window has higher priority than others. Even you
>focus on other opened windows, this VB application is still on the top and
>keep running. I have seen some windows applications like this, I would like
>to know if this can be done in VB, and how?

>a T d H v A a N n K c S e
>(Thanks in advance)

>Jingbo Zheng



Wed, 25 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Make a window always on top (of every window..always)

2. Application window always on top?

3. Window always on top, in vb

4. Howto: make always on top windows in VB 5

5. Help, I want my form ALWAYS staying on top of ANY other window

6. window always on top HELP Please

7. HELP: How to create a VB application that is always-on-top of other windows?

8. Keep Window on top of ALL OTHERS in OS.

9. Help.. VB 4.0 Form question-always on top

10. Always on top application

11. Application always on top

12. VB 5 (and perhaps others) always want 1 tab in a tabstrip

 

 
Powered by phpBB® Forum Software