Jump to content

How do i bring a process windows to front using csharp(c#) ?


Recommended Posts

This is my part of my code in c# the variable au3 is AutoItX3Class.

if (au3.WinExists(processName, "") == 0)
            {
                au3.Run(@"C:\Program Files (x86)\Paint.exe", "", au3.SW_SHOW);
                Thread.Sleep(10000);
                au3.MouseClick("LEFT", 358, 913, 1, -1);

            }
            else
            {
                au3.Run(@"C:\Program Files (x86)\Paint.exe", "", au3.SW_SHOW);
Thread.Sleep(10000);
                au3.MouseClick("LEFT", 358, 913, 1, -1);
            }

 

If the process not exist not running then au3.Run then run it.

But if it does exist I don't want to run it again I just want to show/bring it to the front.

I didn't find any au3 property that bring the process window to the front. au3.Run do it but I don't want to run a process that is already running.

Should I keep using au3.Run in both cases ? Or there is another property only from bringing existing process to the front ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...