'Add
a module into the project and put these codes in the
module. 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 Public Const HWND_BOTTOM = 1 Public Const HWND_NOTOPMOST = -2 Public Const HWND_TOP = 0 Public Const HWND_TOPMOST = -1 Public Const SWP_NOMOVE = &H2 Public Const SWP_NOSIZE = &H1 'Add 1 label,1 combo box , 1 button on the form . And put the 'codes below in the form. Private Sub Command1_Click() Select Case Combo1.ListIndex Case 0 t& = SetWindowPos(Me.hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE) Case 1 t& = SetWindowPos(Me.hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE) Case 2 t& = SetWindowPos(Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE) Case 3 t& = SetWindowPos(Me.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE) End Select End Sub Private Sub Form_Load() Label1.Caption = "Set The Window to:" With Combo1 .AddItem "Bottom", 0 .AddItem "Top ", 1 .AddItem "Top Most", 2 .AddItem "Not Top Most", 3 .ListIndex = 0 End With Command1.Caption = "Run" End Sub
|