opening an exe

This is a discussion on opening an exe within the C# Programming forums, part of the General Programming Boards category; I have a web interface that is to send some information to a C++ exe file. Just for testing purposes, ...

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    32

    Lightbulb opening an exe

    I have a web interface that is to send some information to a C++ exe file. Just for testing purposes, I have only create a main (in the prog) which creates a txt file. Once I click the button, nothing seems to happen (no file created). I even tried to do a Hello World, but Nada...can anyone help because I am totaly lost

    Code:
    <html>
    <head>
    <title>testing</title>
    </head>
    <script language="C#">
    
    using System.Diagnostics;
    
    void StartExecuting_Click (Object sender, EventArgs e) 
    {
       string strfilePath="C:\\ABC\\Interface\\Code\\Debug\\test.exe";
       System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(strfilePath);
    
       psi.UseShellExecute = true;
       psi.WorkingDirectory="C:\\ABC\\Interface\\Code\\Debug\\";
       System.Diagnostics.Process p = System.Diagnostics.Process.Start(psi);
       p.Start(psi);
       
    }
    
    </script>
    
    <body>
    Here...
    <input type="submit" value="submit" onServerClick="StartExecuting_Click"/>
    </body>
    </html>

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    ASP.NET runs on a different account and desktop to the interactive user. A process created on this desktop will not be visible to the interactive user.

    If the spawned process is a console application, an alternative may be to redirect its stdout and display it in the webpage.

    Something like(stolen from web):
    Code:
    Process proc = new Process();
    proc.StartInfo.FileName = "uptime.exe";
    proc.StartInfo.Arguments = "-a";
    proc.StartInfo.UseShellExecute = false;
    proc.StartInfo.RedirectStandardOutput = true;
    
    proc.Start();
    
    StreamReader sw = proc.StandardOutput;
    string myString = sw.ReadToEnd();
    proc.Close();
    
    // Display myString in webpage

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to monitor exe and dll interactions?
    By George2 in forum C Programming
    Replies: 1
    Last Post: 10-26-2007, 04:22 AM
  2. how to run an exe command in c++ and get back the results?
    By mitilkhatoon in forum C++ Programming
    Replies: 5
    Last Post: 09-21-2006, 06:00 PM
  3. Close another exe from another exe??
    By Tony in forum Windows Programming
    Replies: 1
    Last Post: 06-12-2002, 07:19 AM
  4. insert another exe into exe
    By lliero in forum C Programming
    Replies: 8
    Last Post: 04-12-2002, 12:22 PM
  5. adding bytes to EXE to call another EXE
    By lliero in forum C Programming
    Replies: 2
    Last Post: 03-30-2002, 06:23 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21