Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

Starting C app using .Net (API issues in C App)

  • 07-03-2008 12:38PM
    #1
    Registered Users, Registered Users 2 Posts: 214 ✭✭


    Hi All,

    I have a c# .Net application that is responsible for monitoring processes and starting them if they dont exist, see code snippet below:
    ProcessStartInfo psiStartDetails = new ProcessStartInfo();
    psiStartDetails.FileName = "C:\\MyApp.exe" //C Application
    Process proc = new Process();
    proc.StartInfo = psiStartDetails;
    proc.EnableRaisingEvents = true;
    proc.Exited += new EventHandler(StartProcAgain);
     
    proc.Start();
    

    The problem with this is the C application "myApp.exe" uses the FindFirstFile Api to check for the existence of a file, this does not return the expected result for if the file exists or not, but works fine if you double click the exe to start it.

    I tought it was down to permissions using .Net so i checked this out in VB 6 using the Shell command (Same issue).

    I then created a batch file to start the C app (this worked).

    Anyone have any ideas why the Process.Start & Shell commands seem to disable the FindFirstFile API?


Advertisement