4

So, I recently started trying to use an XNA program to start another XNA program. I've been using the normal method of "Process.Start", which works fine when opening Firefox or Media Player. However, whenever I try to start any XNA program (I've tried several), I get the error "No suitable graphics card found. Unable to create the graphics device. This program requires pixel shader 1.1 and vertex shader 1.1." I recognize this as the error when the graphics device can't handle XNA, but that's not the problem here, since I'm already running XNA to begin with.

My code currently looks like this:

System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.FileName = Stat.clientfile;
process.StartInfo.Arguments = "";
process.StartInfo.LoadUserProfile = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.WorkingDirectory = Stat.clientfile.Remove(Stat.clientfile.Length - 1 - Stat.clientfile.Split(Convert.ToChar(@"\"))[Stat.clientfile.Split(Convert.ToChar(@"\")).Length - 1].Length);
process.StartInfo.RedirectStandardOutput = true;
Stat.MessageBox(process.StartInfo.WorkingDirectory);
process.Start();

But that's after trying just about every addition to Process.Start(filename) I could think of. I'm running XNA version 3.1 on an Acer Netbook if it means anything.

If anyone understands what's wrong with this, your help would be greatly appreciated!

Oded
  • 489,969
  • 99
  • 883
  • 1,009
Kezip
  • 43
  • 5
  • I assume you have just tried running the exe you are pointing this to and that runs fine? – T. Kiley Nov 02 '11 at 17:52
  • 2
    Random guess: the XNA program you're calling this from has already 'taken over' the graphics card on your computer, and doesn't want to share. Can you start program #2 manually while program #1 is running? – thedaian Nov 02 '11 at 18:03
  • 1
    Yeah, I can start the second program manually while the first one is still running. I'm thinking the same thing about XNA not wanting to share, but I don't know what to do about it if it's the case. – Kezip Nov 02 '11 at 22:30
  • Just sort of shooting in the dark, but have you tried setting UseShellExecute to true? – blaaaaaaah Nov 21 '11 at 11:14

2 Answers2

2

I was running into the same problem. I found this thread:

http://forums.create.msdn.com/forums/p/94466/566353.aspx

Near the bottom, Kezip says "XNA didn't allow multiple programs to run while one was in full screen." Taking both programs out of fullscreen mode fixed the issue.

JoeProgram
  • 168
  • 1
  • 10
  • Hey guys, sorry I haven't gotten back to this. Joe was right; that was actually a topic I made over there at the same time as writing this one. I had to cheat the system and use Windows.Form's full screen instead of XNA's. Thanks for your responses, and I hope this helps other people as well. – Kezip Dec 24 '11 at 20:06
0

You cant use

process.StartInfo.RedirectStandardOutput = true;

with XNA Applications.

Why? The XNA Application will try to create the graphics device INSIDE the other XNA Process this way, which will 100% fail.

Dont Redirect the output and it will work. (Worked for me in 2 test szenarios with XNA 4.0 - cant say 100% if this is the same in 3.1)

EDIT:

By the way, you better use this to build your WorkingDirectory

process.StartInfo.WorkingDirectory = Stat.clientfile.Substring(0, Stat.clientfile.LastIndexOf('\\'));