I found a lot of code teaching how to put the window on top of others.
Do anybody know how to put one's window at the back of all other windows (they are of different exe programs)
Thanks
Printable View
I found a lot of code teaching how to put the window on top of others.
Do anybody know how to put one's window at the back of all other windows (they are of different exe programs)
Thanks
VB Code:
Option Explicit 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_FRAMECHANGED = &H20 Private Const SWP_NOACTIVATE = &H10 Private Const SWP_NOMOVE = &H2 Private Const SWP_NOREDRAW = &H8 Private Const SWP_NOSIZE = &H1 Private Const SWP_SHOWWINDOW = &H40 Private Const SWP_ALL = SWP_FRAMECHANGED Or SWP_NOACTIVATE Or SWP_NOMOVE Or _ SWP_NOSIZE Or SWP_SHOWWINDOW Private Const HWND_BOTTOM = 1 Private Sub Command1_Click() Call SetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_ALL) End Sub
That won't lock the window at the bottom of the order, but it will get moved there until it gets activated again.
:)
i found that using setparent and place it in the desktop listview it will always stay bottom.
Thanks crptcblade, I will try
BuggyProgrammer, would you mind to elaborate the code used?
VB Code:
Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal _ hWndChild As Long, ByVal hWndNewParent As Long) As Long 'Then go find the Desktop sysListView's handle and ur app's 'handle, then SetParent Me.hWnd, LstViewhWnd
jian25887's last post was in June 2008. PROBABLY not checking this forum any more. Might be best if you start your own thread.
flyguille, GetDesktopWindow().
I tryed to replace those FindWindow, with the GetDesktopWindow, but didn't work, so what is the difference in the pointer fetched?
this works
Code:Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" ( _
ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Private Declare Function SetParent Lib "user32" ( _
ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long
Private Sub Form_Load()
Dim ProgMan&, shellDllDefView&, sysListView&
ProgMan = FindWindow("progman", vbNullString)
shellDllDefView = FindWindowEx(ProgMan&, 0&, "shelldll_defview", vbNullString)
sysListView = FindWindowEx(shellDllDefView&, 0&, "syslistview32", vbNullString)
SetParent Me.hwnd, sysListView
End Sub
and this don't work
Code:
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function SetParent Lib "user32" ( _
ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long
Private Sub Form_Load()
Dim sysListView&
sysListView = GetDesktopWindow()
SetParent Me.hWnd, sysListView
End Sub