473,382 Members | 1,353 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Process::Start problem

Atli
5,058 Expert 4TB
Hi o/

I decided this morning to teach myself C++ \o/... 6 hours later Im just about ready to throw in the towel :)

Anyways I have a minor annoyance you good ppl might be able to help me with.

I created a simple code to open a .exe file in C# wich work fine (all hail C# :P)

Expand|Select|Wrap|Line Numbers
  1. System.Diagnostics.Process proc;
  2. proc = System.Diagnostics.Process.Start(@"C:\dotnetfx.exe");
  3. proc.WaitForExit();
  4.  
  5. MessageBox.Show("omg");
  6.  
Now this is fairly simple. Runs the dotnet.exe and when that closes, it echo's "omg"

And now for the problem.
I tried to do the same thing in C++

Expand|Select|Wrap|Line Numbers
  1. System::Diagnostics::Process proc;
  2. proc.Start("C:\\dotnetfx.exe");
  3. proc.WaitForExit();
  4.  
  5. MessageBox::Show("omgOMG");
  6.  
No matter what I do, the proc.. after I call the Start(...) function, gives me a Exception saying there is no proccess attached to it.

I tried
Expand|Select|Wrap|Line Numbers
  1. proc = System::Diagnostics::Process::Start("C:\\dotnetfx.exe")
but it gives me a build error.

Anybody know what to do?
Jan 15 '07 #1
2 4359
Ganon11
3,652 Expert 2GB
Are you running this in windows? If so, you can use

Expand|Select|Wrap|Line Numbers
  1. system("C:\\dotnetfx.exe");
  2. cout << "omg";
  3. return 0;
to accomplish the same.
Jan 15 '07 #2
Atli
5,058 Expert 4TB
I tried your code. It gives me a error:

error C3861: 'system': identifier not found

This is a part of a Windows application
(Windows::Forms::Form) thingie

The code I posted is inside of a event triggered function, triggered when the form is displayed (this.Shown)

The basic Idea is that I want this program to open up, install .Net framework and then execute my acctuall program, wich is wirtten in C#

this is the entire code..

Expand|Select|Wrap|Line Numbers
  1. public ref class Form1 : public System::Windows::Forms::Form
  2. {
  3.   public:
  4.     Form1(void)
  5.     {
  6.       InitializeComponent();
  7.  
  8.       SetupStart::Form1::Shown::add(gcnew EventHandler(this, &SetupStart::Form1::Execute));
  9.     }
  10.  
  11.   void Execute(Object^ sender, EventArgs^ eArgs)
  12.   {
  13.     // Here Im trying to install .Net
  14.     System::Diagnostics::Proccess proc1;
  15.     proc1.Start("C:\\dotnetfx.exe");
  16.     proc1.WaitForExit();
  17.  
  18.     // This is where my C# app should start
  19.     System::Diagnostics::Proccess proc2;
  20.     proc2.Start("C:\\myapp.exe");
  21.     Application::Exit();
  22.   }
  23. }
I'm using C++ Express 2005 to create this.
Jan 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Doug Wyatt | last post by:
So I'll preface this with the fact that I'm a UNIX developer by training and have just recently gotten in to C# development on Windows. I'm basically running in to a problem whereby I suspect...
2
by: Tobias Johansson | last post by:
Hello, I'm having what I believe a security problem to execute an executable file from a windows service in windows server 2003. It works fine in WIN XP SP2 The program(the service) itself...
10
by: Tony | last post by:
I am running an application called AcroComm.exe to poll time clocks here at our company. I have written a small C# app that will poll the clocks based on information found in a DB. My problem is...
5
by: Dean Slindee | last post by:
I have looked everywhere I can think of for the .exe name of the Windows Picture and Fax Viewer. Anybody know what it's named? Thanks, Dean Slindee
2
by: Jag Chat via .NET 247 | last post by:
I would like to call a .NET executable file in a windows serviceat certain intervals of time. The following is the codesnippet, I put in. I am not receiving any error in my errorhandling routine...
0
by: Sergistm | last post by:
Hello World, :D I have a problem that it is making me crazy, I hope you can help me. I'm trying to execute a .exe file with the Procces.Start, and there is no problem when the file is on my...
4
by: Paul | last post by:
Hi, I am trying to start a process hidden. My code: wordprocess = new System.Diagnostics.Process(); ; wordprocess.StartInfo = new System.Diagnostics.ProcessStartInfo(wcmd, args);...
7
by: =?Utf-8?B?ams=?= | last post by:
I am using System.Diagnostics.Process class to open a word document by call ing Process.Start("test.doc"). I am using C# as programming language. On some of the computers on running this code i get...
4
by: =?Utf-8?B?YmlsbA==?= | last post by:
i'm using VS2005, VB.NET windows forms application when I try to open a web page using process.start, i get an error: "application not found" I'm using this syntax: ...
5
by: sjoshi23 | last post by:
Hello I'm trying to start a remote desktop session using Process.Start but it keeps saying "File not found". The same cmd thru DOS window works fine. I used: C:\\WINDOWS\\system32\\mstsc.exe...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.