Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleSend a window to the top or bottom in Visual Basic 6
DescriptionThis example shows how to send a window to the top or bottom in Visual Basic 6.
Keywordssend window to bottom, send window to top, to top, to bottom, Visual Basic 6
CategoriesControls, API
 
The program uses the SetWindowPos API function to move the window to the top or bottom.
 
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 Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const HWND_BOTTOM = 1
Private Const HWND_TOP = 0

Private Sub cmdSendToBack_Click()
Dim flags As Long

    flags = SWP_NOSIZE Or SWP_NOMOVE
    SetWindowPos Me.hwnd, HWND_BOTTOM, 0, 0, 0, 0, flags
End Sub

Private Sub cmdBringToFront_Click()
Dim flags As Long

    flags = SWP_NOSIZE Or SWP_NOMOVE
    SetWindowPos Me.hwnd, HWND_TOP, 0, 0, 0, 0, flags
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated