Little Fighter Empire - Forums
Embedding an EXE into Another Window - Printable Version

+- Little Fighter Empire - Forums (https://lf-empire.de/forum)
+-- Forum: General Zone (https://lf-empire.de/forum/forumdisplay.php?fid=23)
+--- Forum: Programming (https://lf-empire.de/forum/forumdisplay.php?fid=50)
+--- Thread: Embedding an EXE into Another Window (/showthread.php?tid=9606)



Embedding an EXE into Another Window - A-Man - 02-08-2015

I was wondering if there is a way to to embed a program (say a game window) inside another.
What I am trying to achieve is to allow my C++ application to run other mini games' exes in its window.

Any thoughts?


RE: Embedding an EXE into Another Window - Som1Lse - 02-08-2015

On Windows you have the option of using parent and child windows: http://stackoverflow.com/questions/16626962/is-it-possible-to-embed-one-application-in-another-application-in-windows

I would imagine there is a similar thing available on other platforms, but if you want to embed a mini game into a game I don't really see a reason to not just make it part of the source code.


RE: Embedding an EXE into Another Window - A-Man - 02-08-2015

Thanks for the answer! Did some research, and apparently this can not be done easily especially if the 2 games use different graphical contexts.

As for why:
I wanted to have it possible to let other people add the minigames they wrote in their preferable language into the A-Engine. I believe the best solution is to clearly provide a place for such in the engine's source, and just let those who wish do it and compile the engine themselves.

Thanks a lot, nevertheless!


RE: Embedding an EXE into Another Window - Silverthorn - 02-08-2015

(02-08-2015, 12:18 PM)Doctor A Wrote:  I wanted to have it possible to let other people add the minigames they wrote in their preferable language into the A-Engine.

My guess is, in order to realize something like that, you'd have to provide some kind of API that bridges possibly different contexts of the applications. Seems like quite some hassle and I really would not recommend that :p

Alternatively, launch the "embedded" programs on their own. Ie. once a certain trigger is activated in your program, it will essentially just "run app.exe". That doesn't look too great, though, so idk :p


RE: Embedding an EXE into Another Window - A-Man - 02-08-2015

(02-08-2015, 12:34 PM)Blue Phoenix Wrote:  My guess is, in order to realize something like that, you'd have to provide some kind of API that bridges possibly different contexts of the applications. Seems like quite some hassle and I really would not recommend that :p
Yes, definitely. There could be the following:
-A loadImg(directory) function that loads an image and returns its Texture object where:
---Texture.render(x, y) function renders the texture in (x,y).
---Texture.setColorKey(red, green, blue) sets the colorkey for the texture.
---Texture.moveTo(x, y) moves the texture to (x, y)
---Texture.translate(x, y) translates the texture's geometry by x and y.
---Texture.rotate(angle, center_x, center_y) rotates the texture's geometry by the angle "angle" with (center_x, center_y) being the center.
---Texture.stretch(x_factor, y_factor, center_x, center_y) stretches the geometry by the x, y factors from the center given.
---Texture.shear(x_factor, y_factor, center_x, center_y) shears the geometry by the x, y factors from the center given.
---Texture.reflect(on_x, on_y, center_x, center_y) on_x and on_y being boolean values. Reflects about the center given.
---Texture.resetGeometry() resets the sprite's geometry to normal.
-A loadSound(directory) function that loads a sound file and returns its Sound object where:
---Sound.play() plays the sound
-A loadMusic(directory) function that loads a music file (mp3, ogg..etc) and return its Music object where:
---Music.play(times) plays the music "times" time from the beginning.
---Music.pause() pauses the current running music.
---Music.resume() resumes the paused music.
---Music.setVolume(volume) sets the volume to "volume" (out of a 120).
-A GetCursorPosition() function to get the position of the cursor.
-A isKeyHeld(KeyEnumValue, player_number) function that returns true if the key of the corresponding player is held.
-A isKeyPressed(KeyEnumValue, player_number) function that returns true if the key of the corresponding player  was pressed in the current frame.
-A complement() function that does the rest of the stuff behind the scenes (FPS controlling, checking for events..etc..etc).

Maybe also supply it with more collision detection related functions.
Stuff should be python level of clear if you've made even a single game in your life.


Quote:Alternatively, launch the "embedded" programs on their own. Ie. once a certain trigger is activated in your program, it will essentially just "run app.exe". That doesn't look too great, though, so idk :p
Would be awesome if it would remove the app's frame and move it to the A-Engine's window center, but then it would not feel as professional once it's figured out :P.