4 Replies - 6034 Views - Last Post: 26 September 2013 - 07:42 AM

#1 Iceblitz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 31-July 13

Odd error when attempting to execute an .exe file in Visual Studio.

Posted 31 July 2013 - 05:24 PM

Hello,

My name is nick and today I was working on a game launcher I want for the RPG i'm creating. I decided to make my game launcher in VS 2010, i made it basic just to throw around code and work with it. I encountered an error when trying to load up the .exe file which is my game, for some reason it wont accept the code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace DarksiegeGameLauncher
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            button1.BackColor = Color.Transparent;

            Process.Start("DarksiegeRunner.exe");
        }
    }
}



To the best of my knowledge this is the best way to load up an application by using the process.start(); command. Each time i press the button I get an error. Can someone tell me what I'm doing wrong.

Many thanks,

Nick

Is This A Good Question/Topic? 0
  • +

Replies To: Odd error when attempting to execute an .exe file in Visual Studio.

#2 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3480
  • View blog
  • Posts: 11,867
  • Joined: 12-December 12

Re: Odd error when attempting to execute an .exe file in Visual Studio.

Posted 31 July 2013 - 05:58 PM

Care to share the error with us, and tell us which line it refers to in your posted code.
Was This Post Helpful? 0
  • +
  • -

#3 Iceblitz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 31-July 13

Re: Odd error when attempting to execute an .exe file in Visual Studio.

Posted 01 August 2013 - 05:36 AM

View Postandrewsw, on 31 July 2013 - 05:58 PM, said:

Care to share the error with us, and tell us which line it refers to in your posted code.


Sure i get this error log come up when i try to click it:

Quote

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at DarksiegeGameLauncher.Form1.button1_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.onclick(EventArgs e)
at System.Windows.Forms.Button.onclick(EventArgs e)
at System.Windows.Forms.Button.onmouseup(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.2012 (RTMLDR.030319-2000)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
DarksiegeGameLauncher
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/Nick/AppData/Local/Apps/2.0/NA88O4GD.3MW/5BY9WWRH.CAL/dark..tion_6fc26963dabb9bd7_0001.0000_a16b5d05cecee167/DarksiegeGameLauncher.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.2003 built by: RTMLDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.2001 built by: RTMLDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.2001 built by: RTMLDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


In debugging mode it suggests i click on a link to change the process, but then directs me to a blank page. I'm rather confused about this.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3480
  • View blog
  • Posts: 11,867
  • Joined: 12-December 12

Re: Odd error when attempting to execute an .exe file in Visual Studio.

Posted 01 August 2013 - 05:59 AM

Well, I know little about this, but a few sensible debugging steps should help.

Quote

The system cannot find the file specified

That's a pretty obvious error message.

Does the game flash open briefly? This would indicate that it finds the .exe but there are perhaps some commandline arguments that are needed.

Without a path it will look for the application in the current location, or in the environment paths. You could work out what the current location is (as far as your application is concerned) or, in the meantime, specify the absolute path to the game. This is the first thing I would normally attempt.

Also test by running "DarksiegeRunner.exe" from the commandline to see if it would normally run without error in this way.

It could be that the .exe is in a protected location, or a location that you currently don't have sufficient permissions to run from.

Quote

file:///C:/Users/Nick/AppData/Local/Apps/2.0/NA88O4GD.3MW/5BY9WWRH.CAL/
dark..tion_6fc26963dabb9bd7_0001.0000_a16b5d05cecee167/DarksiegeGameLauncher.exe

I do not know whether this indicates where it found the file, or where it was looking for it. Someone else might confirm this.

This post has been edited by andrewsw: 01 August 2013 - 06:19 AM

Was This Post Helpful? 0
  • +
  • -

#5 danny_kay1710  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 28
  • View blog
  • Posts: 358
  • Joined: 27-April 08

Re: Odd error when attempting to execute an .exe file in Visual Studio.

Posted 26 September 2013 - 07:42 AM

Your code relies on the application your trying to execute being in the same folder as the launcher.

As visual studio will compile your launcher project into the bin\Debug or bin\Release folder within your project folder you will either need to specify a full path or add the game files into the folder relating to the build your compiling.

Could I also suggest that you do some checking before hand in order to provide a better experience?

http://msdn.microsof...ile.exists.aspx for example?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1