Help! Always on top.. 
Author Message
 Help! Always on top..

How do I make a form to be always on top? even over other applications.

I would like to make a control pad for different applications..

Thanks,



Tue, 07 Mar 2000 03:00:00 GMT  
 Help! Always on top..

'this goes in bas file under declarations

Declare Sub SetWindowPos Lib "User" (ByVal hWnd As Integer, ByVal
hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal
cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer)

Global Const CONHWNDTOPMOST = -1
Global Const CONHWNDNOTOPMOST = -2
Global Const CONSWPNOACTIVATE = &H10
Global Const CONSWPSHOWWINDOW = &H40

'now i make it to where they can choose so have something to 'where they
can choose and make a form or something show and 'use this....

Sub Form_Load ()
If frmONTOP.Visible = True Then
    SetWindowPos hWnd, CONHWNDTOPMOST, 0, 0, 0, 0, CONSWPNOACTIVATE Or
CONSWPSHOWWINDOW
Else
    SetWindowPos hWnd, CONHWNDNOTOPMOST, 0, 0, 0, 0, CONSWPNOACTIVATE Or
CONSWPSHOWWINDOW
End If
End Sub

-=?(D sk=-



Tue, 07 Mar 2000 03:00:00 GMT  
 Help! Always on top..

Hi - you do this (32-bit):

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_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Public Const SWP_NOACTIVATE = &H10
Public Const SWP_SHOWWINDOW = &H40

Public Sub SetWindowOnTop(xForm As Form, ByVal fOnTop As Boolean)
  Dim status As Long
  Dim xFlag As Long
  Dim xFaktor As Integer

  xFlag = HWND_TOPMOST
  xFaktor = Screen.TwipsPerPixelX '// converting twips to pixels

  If Not fOnTop Then xFlag = HWND_NOTOPMOST
  With xForm
    status = SetWindowPos(.hwnd, xFlag, .Left / xFaktor, .Top / xFaktor,
Width / xFaktor, .Height / xFaktor, SWP_NOACTIVATE Or SWP_SHOWWINDOW)
  End With
End Sub

Jan.



Wed, 08 Mar 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help!! ...Always on top

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

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

4. Always on top (ALWAYS)

5. Make a form always on top - always

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

7. Help with Always on Top VB6 please?

8. Always on top help...

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

10. Help with Always on top positioning

11. help: always on top

12. ALWAYS ON TOP, need help!

 

 
Powered by phpBB® Forum Software