Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

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

Options
  • 07-03-2008 1:38pm
    #1
    Registered Users 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