开发者

How to close a MessageBox generated by some Application

I am trying to close the message box which is generated by Internet explorer. Actually when I play a game on line it shows me a message box "You have played More than 30min. Click OK to exit or Cancel to play more". I want to click on Cancel button, for this I have designed a program :

    private void timer2_Tick(object sender, EventArgs e)
    {
        string Col = GetPixelColor(407, 302).B.ToString();
        if (Col == "200")
        {
            SendKeys.Send("{ESC}");
        }

    }

this programs check the colour of pixel (belong to Messagebox) and if found it sends Escape key The title of message b开发者_开发知识库ox is "Windows Internet Explorer". But this program fails when unfortunatily the back ground of game become Light grey and it sends the Escape key which closes the game and lost the score.


I would take a look at FindWindow. Some information and source code can be found here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜