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

  • SEARCH
  • Home
  • 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 7607647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:43:01+00:00 2026-05-31T00:43:01+00:00

I am trying to start an external process and wait for it to be

  • 0

I am trying to start an external process and wait for it to be active before continuing the execution of my program. I am searching based upon process name, but I have a problem with my implementation if the process name is not what I expect.

//When Method1 is called, it will load the data and bring a pop up
//as adobe save dialog box (as a save dialog exe in the task bar)
Method1(); 

while (true)
{
    foreach (Process clsProcess in Process.GetProcesses())
    {
        if (clsProcess.ProcessName.Contains("AdobeARM"))
        {
            isOpened = true;
        }
    }  

    //Once the pop up from Method 1 comes i call other methods     
    if (isOpened)
    {
        Method2();
        Method3();
        Method4();
        break;
    }
}

This could cause an infinite loop if the process is never found! What is the best way to handle this or alternative to while loop?

  • 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-31T00:43:03+00:00Added an answer on May 31, 2026 at 12:43 am

    Get rid of the while.

    It’ll perform the check and then if the AdobeARM process is there it will run your methods and if not will skip them. Put everything right there after Method1 in a separate function and call that function from a System.Threading.Timer.

    Note that depending on how it is used in your application you may want to add extra handling for threading issues.

    private Timer myTimer;
    
    private void DoSomething()
    {
        if (myTimer != null)
        {
            myTimer.Dispose();
            myTimer = null;
        }
    
        Method1();
    
        myTimer = new Timer(CheckForProcess, null, 100, 100);
    }
    
    private void CheckForProcess(object state)
    {
        bool isOpened = false;
        foreach (Process clsProcess in Process.GetProcesses())
        {
            if (clsProcess.ProcessName.Contains("AdobeARM"))
            {
                isOpened = true;
                break;
            }
        }
    
        //Once the pop up from Method 1 comes i call other methods     
        if (isOpened)
        {
            myTimer.Dispose();
            myTimer = null;
            Method2();
            Method3();
            Method4();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run an external problem from C# by using Process.Start, but am
I want to start a process (calling another program), currently the external program takes
I'm trying to start an external process via Java using the ProcessBuilder class, and
I'm trying to start using LINQ and specifically LINQ to SQL but I'm having
I am actually trying to start a process for winzip and zip a folder.
I'm trying to start a program using QProcess (Qt4.4 on vista64bit, developing in MSVC2005).
I'm trying to use an external library (wingraph) in a simple program. I have
Two (related?) questions here. I was trying to write a program to start an
I'm trying to execute an external command from java code, but there's a difference
I am trying to use an external mysql database in my java application, but

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.