Posted by Catur Nugroho | File under :

Autoit Win Active Using C#

Checks to see if a specified window exists and is currently active.
WinActive ( "title" [, "text"] )

Parameters

title The title of the window to check. See Title special definition.
text [optional] The text of the window to check.

Return Value

Success: Returns the handle to the window if it is active.
Failure: Returns 0 otherwise.

Remarks

None.

Source : Autoit Help Document

Autoit Win Active In C#



Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Time Out :

 private void winWaitbutton_Click(object sender, EventArgs e)
        {           
            //open notepad
            autoit.Run("Notepad.exe", "", 1);

            //Wait a maximum of 20 seconds for "[CLASS:Notepad]" to exist
            autoit.WinWait("[CLASS:Notepad]", "", 20);

            if (autoit.WinActive("[CLASS:Notepad]", "") == 0)
            {
                MessageBox.Show("Notepad didn't active");
            }
        }


Download Full Source Code

0 comments:

Post a Comment