Jump to content

MsgBox without title


nynepro
 Share

Recommended Posts

Can somebody tell, how can I push the button on MsgBox without title... There is some program, which sometimes call MsgBox with 2 button's ("OK" and "Cancel") and there is no title here. I need to press Cancel button.

Im trying

ControlClick ("", "Cancel", "[CLASS:Button; INSTANCE:2]")
or
ControlClick ("", "Cancel", "Button2")
or even
ControlClick ("", "Cancel", "Button2", "left", 1, 317, 60)
but its doesnt work...

>>>> Window <<<<

Title:

Class: #32770

Position: 327, 463

Size: 633, 147

Style: 0x940001C5

ExStyle: 0x00010101

Handle: 0x002806C6

>>>> Control <<<<

Class: Button

Instance: 2

ClassnameNN: Button2

Advanced (Class): [CLASS:Button; INSTANCE:2]

ID: 2

Text: Cancel

Position: 317, 60

Size: 75, 23

ControlClick Coords: 17, 12

Style: 0x50010000

ExStyle: 0x00000004

Handle: 0x00300786

>>>> Mouse <<<<

Position: 334, 72

Cursor ID: 2

Color: 0x250875

>>>> StatusBar <<<<

>>>> Visible Text <<<<

OK

Cancel

P.S. sry for my English

Link to comment
Share on other sites

The MsgBox() function halts the script until a button is pressed or until the end of the "timeout" parameter,

This is one way the Msgbox button can be pressed.

#include <Timers.au3>
#include <WinAPI.au3>

$hGUI = GUICreate("")
GUISetState()

$msgb = _Timer_SetTimer($hGUI, 500, "_Update"); create timer

MsgBox(1, "", "First MsgBox"); Autoclicks First MsBox

_Timer_KillTimer($hGUI, $msgb)

MsgBox(1, "", "Second MsgBox"); Timer is not working for this MsgBox

; "#32770" being the Class name of the active MsgBox
Func _Update($hWnd, $Msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
;ConsoleWrite(WinGetHandle("") & @CRLF)
    If _WinAPI_GetClassName(WinGetHandle("")) = "#32770" Then ControlSend(WinGetHandle(""), '', "Button2", "{ENTER}");
EndFunc  ;==>_UpdateStatusBarClock
Link to comment
Share on other sites

  • Moderators

The MsgBox() function halts the script until a button is pressed or until the end of the "timeout" parameter,

This is one way the Msgbox button can be pressed.

#include <Timers.au3>
#include <WinAPI.au3>

$hGUI = GUICreate("")
GUISetState()

$msgb = _Timer_SetTimer($hGUI, 500, "_Update"); create timer

MsgBox(1, "", "First MsgBox"); Autoclicks First MsBox

_Timer_KillTimer($hGUI, $msgb)

MsgBox(1, "", "Second MsgBox"); Timer is not working for this MsgBox

; "#32770" being the Class name of the active MsgBox
Func _Update($hWnd, $Msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
;ConsoleWrite(WinGetHandle("") & @CRLF)
    If _WinAPI_GetClassName(WinGetHandle("")) = "#32770" Then ControlSend(WinGetHandle(""), '', "Button2", "{ENTER}");
EndFunc ;==>_UpdateStatusBarClock
I think you missed the point of him dealing with an application other than his own AutoIt app.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...