Jump to content
  • Advertisement
Sign in to follow this  
Doc Zetar

How to exec a Windows exe from XNA and run an XNA program from Windows

This topic is 521 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

Okay, I'm ready for the laughter and the ridicule but for a number of reasons the project that I'm working on is easiest to produce as a number of standalone programs like this:

Flow-Chart.jpg

For now the Main Menu program will probably be written in XNA 4.0. The Create Map program will be written in XNA 4.0. The Create Army program is already written in Windows WPF. The Create Scenario program will be in XNA 4.0. The Play Scenario program will be written in XNA 4.0

 

The question is: how do I run a Windows program from XNA 4.0 AND conversely how do I run an XNA program from a Windows program?

This code (the path is correct) doesn't work: 

Process.Start("C:\\Users\\EZRA\\Documents\\General Staff\\General Staff AI\\trunk\\ArnyDesignModule\\bin\\Debug\\ArmyDesignModule.exe");

I understand that there are some problems from switching from XNA to Windows and back but I can't find any documentation on this. 

Anybody have any ideas?

Share this post


Link to post
Share on other sites
Advertisement

You've got spaces in there.  It has nothing to do with XNA.

 

Some options are to use a ProcessStartInfo object to contain the path, to add escape tags to each space, or wrap it in a quote.  The easiest is the quotes in the string:

 

Process.Start("\"C:\\Users\\EZRA\\Documents\\General Staff\\General Staff AI\\trunk\\ArnyDesignModule\\bin\\Debug\\ArmyDesignModule.exe\"");

 

That leaves various other problems like hard-coded paths, calling the debug bin version in all builds, and interprocess communication between the processes, but at least the process should start with that.

Share this post


Link to post
Share on other sites

Obviously, I wasn't going to leave this as a hard coded absolute path. I'm just trying to make sure the basic concept works.

 

Anyway, I copied the main menu XNA executable into the same folder as the WPF program that I wanted to run and it worked. So, I probably need to set up the relative path for the directory of Design Army module exe.

 

Thanks.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!