Click here to Skip to main content
15,888,270 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have tried to run an exe file the code is given below

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

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

        private void button1_Click(object sender, EventArgs e)
        {
            Process p = new Process();

            try
            {

                string path;
           
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.FileName = @"\\192.168.0.1\\public\\Akmal\\IBTalk_Screenshare.exe";
                p.Start();
         
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.ToString());
                MessageBox.Show("Installation Canceled");

            }
        }
    }
}


Now when i publish the project , In the result a form is installed on the system , but when i click the button it show me the exception

System.ComponenetModel.Win32Exception The Network name cannot be found at
System.Diagnostic.Process.StartWithShellExecuteEx(ProcessStartInfo,StartInfo)
at System.Diagnostic.Process.Start(ProcessStartInfo,StartInfo)
at ApplicationShield.Form1.Button1_Click(Object sender,EventArgs e)

it runs perfectly on Windows XP but it show the above mentioned Exception in windows 7
Posted
Updated 24-Jun-13 1:18am
v2
Comments
José Amílcar Casimiro 24-Jun-13 8:41am    
System.ComponenetModel.Win32Exception The Network name cannot be found at
System.Diagnostic.Process.StartWithShellExecuteEx(ProcessStartInfo,StartInfo)
at System.Diagnostic.Process.Start(ProcessStartInfo,StartInfo)
at ApplicationShield.Form1.Button1_Click(Object sender,EventArgs e)

Make sure that your windows 7 can read the share, by accessing the share from the command line for example.
Akmal Abbas Naqvi 28-Jun-13 3:27am    
Thanks for your answer !
But i solved this problem ,
appreciate your effort !!!

1 solution

Hi,

Change:
C#
p.StartInfo.FileName = @"\\192.168.0.1\\public\\Akmal\\IBTalk_Screenshare.exe";

into:
C#
p.StartInfo.FileName = @"\\192.168.0.1\public\Akmal\IBTalk_Screenshare.exe";

Hope this helps.
 
Share this answer
 
v3
Comments
Akmal Abbas Naqvi 24-Jun-13 7:33am    
@ProgramFox Thanks for your quick response
The thing is that if i give @"\\192.168.0.1\\public\\Akmal\\IBTalk_Screenshare.exe"; in windows xp it runs the exe
should i have to change the Installation URL in the publish tab
My Publish Location is \\192.168.0.1\PUBLiC\Akmal\ProcessEnd\
and my Installation URL is \\192.168.0.1\PUBLiC\Akmal\ProcessEnd\
Thomas Daniels 24-Jun-13 7:39am    
I think you should change the Installation URL into \\192.168.0.1\PUBLiC\Akmal\ProcessEnd\IBTalk_Screenshare.exe
Just add <small>IBTalk_Screenshare.exe</small>
Akmal Abbas Naqvi 24-Jun-13 7:46am    
Hi ! I tried this but then it shows the error that application is not downloaded
Thomas Daniels 24-Jun-13 7:49am    
I'm sorry, but I don't know anything about publishing. I can't help you further. I'm sorry.
Akmal Abbas Naqvi 24-Jun-13 7:55am    
No Problem @ProgramFox
And Thanks for your quick response again ,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900