Results 1 to 2 of 2

Thread: Allways on top

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    9
    How do I do to keep an window allways ont top ?

    Nankien

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    Paste this into a module

    you can then pass the form name as a parameter

    Code:
    Public Const HWND_TOPMOST = -1
     Public Const HWND_NOTOPMOST = -2
     Public Const SWP_NOACTIVATE = &H10
    Public Const SWP_SHOWWINDOW = &H40
    Declare Sub 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)
    
    
    Sub NotOnTop(Form As Form)
    SetWindowPos Form.hwnd, HWND_NOTOPMOST, Form.Left / 15, _
                               Form.Top / 15, Form.Width / 15, _
                              Form.Height / 15, SWP_NOACTIVATE Or SWP_SHOWWINDOW
    
    End Sub
    
    ''''''''''''''''''
    Sub OnTop(Form As Form)
    SetWindowPos Form.hwnd, HWND_TOPMOST, Form.Left / 15, _
                                Form.Top / 15, Form.Width / 15, _
                                Form.Height / 15, SWP_NOACTIVATE Or SWP_SHOWWINDOW
    End Sub
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width