Hi all,
I am using shell to call the calculator from an MDI app that always has at least one child open. However, the calculator is not on top once I click @ the MDI app.
Dim CalhWndApp As Long
Dim hProcessID As Long
Dim hWndDesktop As Long
Dim hWndChild As Long
Dim hWndChildProcessID As Long
hProcessID = Shell("calc.exe", vbNormalFocus)
hWndDesktop = GetDesktopWindow()
hWndChild = GetWindow(hWndDesktop, GW_CHILD)
Do While hWndChild <> 0
Call GetWindowThreadProcessId(hWndChild, hWndChildProcessID)
If hWndChildProcessID = hProcessID Then
CalhWndApp= hWndChild
Exit Do
End If
hWndChild = GetWindow(hWndChild, GW_HWNDNEXT)
Loop
SetWindowPos CalhWndApp , HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
Thanks
Code Monkey