home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD176133262001.psc / Ontop.bas < prev    next >
Encoding:
BASIC Source File  |  2001-03-12  |  1013 b   |  31 lines

  1. Attribute VB_Name = "zOnTop"
  2. Option Explicit
  3. #If Win16 Then 'Conditional Compile statements
  4.     Declare Sub SetWindowPos Lib "User" (ByVal hWnd As Integer, ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer)
  5. #Else
  6.     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
  7. #End If
  8.  
  9. Sub KeepOnTop(F As Form)
  10. 'sets the given form On TopMost
  11. Const SWP_NOMOVE = 2
  12. Const SWP_NOSIZE = 1
  13.  
  14. Const HWND_TOPMOST = -1
  15. Const HWND_NOTOPMOST = -2
  16.  
  17.     SetWindowPos F.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
  18.  
  19. End Sub
  20. Sub KeepOffTop(F As Form)
  21. 'sets the given form Off TopMost
  22. Const SWP_NOMOVE = 2
  23. Const SWP_NOSIZE = 1
  24.  
  25. Const HWND_TOPMOST = 1
  26. Const HWND_NOTOPMOST = 2
  27.  
  28.     SetWindowPos F.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
  29.  
  30. End Sub
  31.