Article ID: 192254
Article Last Modified on 5/13/2003
' SetWindowPos Function
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 Flags
Public Const SWP_NOSIZE = &H1
Public Const SWP_NOMOVE = &H2
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Private Sub Form_Load()
Command1.Caption = "Make Topmost"
Command2.Caption = "Unload Form2"
End Sub
Private Sub Command1_Click()
Call SetWindowPos(Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOSIZE Or SWP_NOMOVE)
End Sub
Private Sub Command2_Click()
Call SetWindowPos(Me.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, _
SWP_NOSIZE Or SWP_NOMOVE)
Unload Me
End Sub
Private Sub Form_Load()
Command1.Caption = "Show Form2"
Call SetWindowPos(Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, _
SWP_NOSIZE Or SWP_NOMOVE)
End Sub
Private Sub Command1_Click()
Form2.Show vbModeless, Me
End Sub
Additional query words: kbDSupport kbDSD kbVBp kbVBp600bug kbVBp500bug kbAPI kbSDKWin32 kbUserGrp
Keywords: kbbug KB192254