Jobs
Author: omidles Date Submitted: 11/11/2005 Category: Forms Compatibility: VB 6 This code has been accessed 7506 times.
Email Yourself this snippet:
Private Const HWND_BOTTOM = 1 Private Const HWND_NOTOPMOST = -2 Private Const HWND_TOP = 0 Private Const HWND_TOPMOST = -1 Private Const SWP_NOMOVE = &H2 Private Const SWP_NOSIZE = &H1 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 Private Declare Function GetActiveWindow Lib "user32" () As Long Public Sub MakeWindowAlwaysTop(hwnd As Long) SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE End Sub Public Sub MakeWindowNotTop(hwnd As Long) SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE End Sub
Code
Private Sub Form_Load() Timer1.Interval = 1 End Sub Private Sub Timer1_Timer() MakeWindowAlwaysTop Me.hwnd End Sub