Advertisement
2002C Miscellaneous #11415

Keep a form on top!

This code keeps a form on top of all other windows.

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
'code:
Private Sub FormOnTop(frm As Form, blnOnTop As Boolean)
  Dim lPos As Long
  Select Case blnOnTop
    Case True
      lPos = HWND_TOPMOST
    Case False
      lPos = HWND_NOTOPMOST
  End Select
  Call SetWindowPos(frm.hwnd, lPos, 0, 0, 0, 0, SWP_FLAGS)
End Sub
'usage:
Private Sub Form_Load()
'makes a form on top
  Call FormOnTop(Me, True)
End Sub
Private Sub Command1_Click()
'makes a form not always on top anymore..
  Call FormOnTop(Me, False)
End Sub
Original Comments (3)
Recovered from Wayback Machine