VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Make a form stay on top of all other applications

by Robin Hickmott (5 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 14th January 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Make a form stay on top of all other applications

API Declarations


Const SWP_NOSIZE = 1
Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2

Rate Make a form stay on top of all other applications



      (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 Function SetTopMostWindow(hwnd As Long, Topmost As Boolean) As Long
   If (Topmost) Then
      SetTopMostWindow = SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
   Else
      SetTopMostWindow = SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
      SetTopMostWindow = False
   End If
End Function

'SetTopMostWindow Me.hwnd, (TRUE,FALSE)

Private Sub Form_Load()
   SetTopMostWindow Me.hwnd, TRUE
End Sub



Download this snippet    Add to My Saved Code

Make a form stay on top of all other applications Comments

No comments have been posted about Make a form stay on top of all other applications. Why not be the first to post a comment about Make a form stay on top of all other applications.

Post your comment

Subject:
Message:
0/1000 characters