Results 1 to 2 of 2

Thread: Make the window permanently on top

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2000
    Location
    Posts
    124

    Make the window permanently on top

    How do I make the window of my application stays on top of the screen permanently even though other application launch later ?
    Thanks.

  2. #2
    Frenzied Member mlewis's Avatar
    Join Date
    Sep 2000
    Posts
    1,226
    SetWindowPos API. Post this code into a form:

    VB Code:
    1. Option Explicit
    2.  
    3. 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
    4.  
    5. Private Const HWND_TOPMOST = -1
    6. Private Const SWP_NOMOVE = &H2
    7. Private Const SWP_NOSIZE = &H1
    8. Private Const SWP_STAY_AS_IS = SWP_NOMOVE Or SWP_NOSIZE
    9.  
    10.  
    11. Private Sub Form_Load()
    12.     SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_STAY_AS_IS
    13. End Sub
    M. Lewis
    Pi-Q Software
    How many mouse clicks does it take to cook breakfast?

    Blargh! I am dead!

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