by Md.Mafuzul Islam Mafuz (7 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 1st June 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
KEEP YOUR APPLICATION ALWAYS ON TOP THAN OTHER APPLICATIONS
API Declarations
'position, and Z order of a child, pop-up, or
'top-level window. Child, pop-up, and top-level
'windows are ordered according to their appearance
'on the screen. The topmost window receives the
'highest rank and is the first window in the Z
'order.
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
'SetWindowPos(
'hWnd >> handle of window
'hWndInsertAfter >>placement-order handle
'X >> horizontal position
'Y >> vertical position
'cx >> width
'cy >> height
'uFlags>>window-positioning flags
' )
Private Const SWP_NOMOVE = &H2
'//SWP_NOMOVE: Retains the current position (ignores
'the X and Y parameters).
Private Const SWP_NOSIZE = &H1
'//SWP_NOSIZE:Retains the current size (ignores the
'cx and cy parameters
Private Const HWND_TOPMOST = -1
'//HWND_TOPMOST:Places the window above all
'non-topmost windows. The window maintains
'its topmost position even when it is deactivated.
''''''''''''''''''''''''''''''''''''''''''
'KEEP YOUR APPLICATION ALWAYS ON TOP THAN'
'OTHER APPLICATIONS '
'MD.MAFUZUL ISLAM MAFUZ '
'Web:www.mafuz.com '
'E-mail:[email protected] '
'BANGLADESH '
''''''''''''''''''''''''''''''''''''''''''
Call SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End Sub