|
-
August 27th, 2001, 11:43 AM
#1
Running Independent App
How can I start up an independent executable (Notepad, say) and force it to "live" (look like it's executing) inside a window on my VB form (e.g., inside a BIG textbox)? I've tried using CreateProcess specifying a position and size but only the positioning seems to work. Also I want to be able to move my VB form around and have the child executable move with it.
-
August 28th, 2001, 02:02 AM
#2
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
-
August 29th, 2001, 10:17 AM
#3
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
-
August 30th, 2001, 06:04 PM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|