Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

HellRaider

Is there a way to launch a 3rd party program as a child window of your program?

This topic is 6692 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a way to launch a 3rd party program as a child window of your program? I.E: Open 2 instances of the Notepad program as a child window inside my program. The Notepad is only an example, the program I''d like to use is much more complex (it''s a 2D game using DX7). I''ve seen some programs doing something similar to what I want to do. If it''s possible to make it... how much would the program slow down? I have no idea if it''s possible or not. If it''s impossible, pardon me for my ignorance :D. Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
It''s real easy, first you need the hwnd from the window you want inside another window.If the window you want is from a different application, you can use FindWindow to get it, if its a window from the current application, you can figure out a way to get it without FindWindow (shouldn''t be hard; if worst comes to worst you can always use a global).FindWindow works like this

HWND FindWindow(char *windowclassname,char *windowtitle)

you can use the spy program to find out class names for other programs.Also note this will only find the first window with the specified class name; if multiple windows exist with the same class name, it''ll only return the first one it finds (it searches in z-order, so it would be the topmost window of the same class).
Now you have the hwnd, use the SetParent function

HWND SetParent(HWND window,HWND newparent)

window is the window you want to be inside your window, and newparent is your window.The return HWND is the window''s old parent window, which you can use to un-set it with.You make also want to use MoveWindow to position it inside your window.
As far as slowing things down, it shouldn''t; The application''s thread will still be different from yours.
If the window does not yet exist (i.e., your program is executing the program) you can use ShellExecute to run the program and specify your window as the parent window.

Good luck

Share this post


Link to post
Share on other sites
Jesus, that was easy! LOL

It worked!

I handn''t tried that function because it''s documentation at MSDN says it can only be used to set the parent window of a child window you currently own inside your app.

Thanks a lot bro!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!