Results 1 to 3 of 3

Thread: How do you keep a form on top?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2001
    Location
    Southern California
    Posts
    733

    How do you keep a form on top?

    How can you keep a form on top and/or visible while still being able to work on another form?

    Thanks,
    Jeff

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    This question is asked every other day. Try searching the forums.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3
    TheMechanic
    Guest
    I think this is what you need make a form with a menu item 'mnuTopmost' and try it

    VB Code:
    1. Private Const Swp_NoSize As Long = &H1
    2. Private Const Swp_NoMove As Long = &H2
    3.  
    4. Private Const Hwnd_TopMost As Long = -1
    5. Private Const Hwnd_NoTopMost As Long = -2
    6.  
    7. 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
    8. Private Sub mnuTopmost_Click()
    9.    ' Add or remove the check mark from the menu.
    10.    mnutopmost.Checked = Not mnutopmost.Checked
    11.    If mnutopmost.Checked Then
    12.       ' Turn on the TopMost attribute.
    13.     SetWindowPos hWnd, Hwnd_TopMost, 0, 0, 0, 0, Swp_NoMove Or Swp_NoSize
    14.    Else
    15.       ' Turn off the TopMost attribute.
    16.     SetWindowPos hWnd, Hwnd_NoTopMost, 0, 0, 0, 0, Swp_NoMove Or Swp_NoSize
    17.    End If
    18. End Sub


    Hope it helps

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