If Example.exe not running close example2.exe

Before you respond beware that i am very noob at c++ and was hoping for some help on a very small work im working on.
What this code do is basicly starting a .bat file that starts another program that starts a game in window mode. bad part is that when i shut the game down from inside i got some programs i have to shut down aswell. Any simple code that can continously update until the program shuts down and then shut it all down?
For the batch file as long as you are launching the executable with a parameter to the batch file to wait for the exe to return AND the exe's main function is declared as an int (Like it is supposed to be) then it should pause execution while your app is running then continue after you exit it.

If this is not the case then we need more detail, what programs are you needing to close?
Last edited on
The program to close is something called 3D Analyze and also the .bat file that started it.
The batch file should close as soon as it has executed all of the code it has, are you holding it open? Could you post the batch files content?

I think that once we get the batch file issue figured out we'll just add a taskkill command to the end of it to close 3D Analyze and that will be that.
"D:\Program\3D Analyzer\3DAnalyze.exe" /EXE=D:\Spel\HoN\hon.exe

this is all in it, I did not make it though 3D Analyze did so i dont have to start 3d a and then start HoN trough it.
I am assuming that you wrote hon.exe or that you can modify the code and recompile it.

Hmmm, this is an interesting situation you've written yourself into. Can I persuade you to not use a batchfile for the launch? It can be done with CreateProcess(...) and that leaves us with more options: http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx

Otherwise the "solution" that I have is really sloppy and not quite thought through yet.
Last edited on
The batch file have not bin thoched by me at all since all i did was choose options in 3D analyzer and clicked "Save Batch file" but if you beleave that 3D A will understand whats happening even though i do it your way then ill try it

I do not fully understand CreateProcess though so could you type up an example?
Last edited on
I would need you to modify hon.exe, I am assuming you wrote it. Otherwise there's nothing in this post relating to C++ and I'm out of my element.
HoN.exe is not my game no. What im doing is trying to put together some code in order for HoN to be run in windowmode as it does not support it im forcing it too do so with 3D analyze but as i said it leaves alot of programs open after i close HoN. So the program im wrighting is as i said very simple so it starts the .bat file in order for me to have the exe in the bottom list in Windows 7 since you can not have .bat files there. the program also closes after doing this but that is all. So im trying to find a way to also close it in a more smooth way by killing of the "restovers" that was used to make the window mode work.
Sorry but i just trying to learn C++ so im very bad at it at this point...
So... you wrote an exe in C++ that opens a batch file that opens 3D Analyze to open this program in windowed mode... This is so round about that I don't even know where to begin.

I'd say scrap the direction you're going now, use the right tool for the job. Have you tried writting this in the batch file:
 
D:\Spel\HoN\hon.exe  -window

or
 
D:\Spel\HoN\hon.exe  -w

This is an older trick but it works more often then not.
I did not do this in the actual .bat file although i read on a few forums that you could wright that in a shortcut to the game but it did not work.

I tried doing it in the batch file but dident work either
Last edited on
I don't know if I can help you with this one. Sorry
Topic archived. No new replies allowed.