Re: Running Independent App
If you manage to retrieve the hWnd, you could use the SetParent API to change the programs parent. This allows you to change it to some MDI window, or any other container that has a hWnd, like a picturebox.
I can't really remember, but there is a way to get the hWnd from a process, and there is a way to get the process from the value you get from the Shell function, so it is possible, just havent done this before.
Tom Cannaerts
[email protected]
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
Re: Running Independent App
Try this...
option Explicit
private Declare Function SetParent Lib "user32" (byval hWndChild as Long, byval hWndNewParent as Long) as Long
private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (byval lpClassName as string, byval lpWindowName as string) as Long
private Sub Command1_Click()
Dim hWnd as Long
Shell "Notepad.exe", vbNormalFocus
hWnd = FindWindow("Notepad", "Untitled - Notepad")
If hWnd <> 0 then
SetParent hWnd, me.hWnd
End If
End Sub
Re: Running Independent App
This kind of works. The Notepad clone I am using (MetaPad) works fine, but other (VB) exe's seem to ignore the SetParent request completely. I'm going to continue looking into this. Thanks for your input tho.