Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 699789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:25:31+00:00 2026-05-14T03:25:31+00:00

I am trying to integrate with a vendors app by calling it with command

  • 0

I am trying to integrate with a vendors app by calling it with command args from c#. It is meant to automate a process that we need to do with out needing anyone to interact with the application. If there are no errors when running the process it works fine.

However if there are any errors the vendors application will show a message box with the error code and error message and wait for someone to click the ok button. When the ok button is clicked it will exit the application returning the error code as the exit code.

As my application is going to be a windows service on a server, needing someone to click an okay button will be an issue. Just wondering what the best solution would be to get around this.

My code calling the vendor app is…

ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "someapp.exe"
startInfo.Arguments = "somefile.txt";

Process jobProcess = Process.Start(startInfo);
jobProcess.WaitForExit();

int exitCode = jobProcess.ExitCode;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:25:31+00:00Added an answer on May 14, 2026 at 3:25 am

    Very quick, nasty and dirty code below. What you really want to do is have a loop that looks for a particular dialog box every second or and sends enter to it if it sees it. This should get you over the hill for now, however (untested, btw):

    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.FileName = "someapp.exe"
    startInfo.Arguments = "somefile.txt";
    
    Process jobProcess = Process.Start(startInfo);
    
    //wait for the process to potentially finish...if it generally takes a minute to end, wait a minute and a half, etc
    System.Threading.Thread.Sleep(60 * 1000);
    
    Process[] processes = Process.GetProcessesByName("someapp");
    
    if (processes.Length == 0)
    {
      break; //app has finished running
    }
    else
    {
      Process p = processes[0];  
      IntPtr pFoundWindow = p.MainWindowHandle;
      SetFocus(new HandleRef(null, pFoundWindow));
      SetForegroundWindow((int)pFoundWindow);
      SendKeys.SendWait("{ENTER}");          
    }
    
    int exitCode = jobProcess.ExitCode;
    

    Option B is to modify their console app – find the MessageBoxA call and replace it with MOV EAX, 1 so that the dialog box never shows up and it’s like the user clicked ‘OK’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.