Привет еще раз.
А не подскажет кто по данному отрывку кода, почему всегда выполняется нажатие кнопки1?
#include <WindowsConstants.au3>
#include <GuiConstants.au3>
#include <GUIConstantsEx.au3>
Local $sChek, $rand
$sGui = GUICreate("", 60, 30, 0, 0, $WS_POPUP + $WS_BORDER, $WS_EX_TOPMOST)
$button0 = GUICtrlCreateButton('START', 0, 0, 60, 30, $BS_PUSHLIKE)
GUICtrlSetFont(-1,11,700)
$button1 = GUICtrlCreateButton('Кнопка1', 1, 30, 58, 30)
$button2 = GUICtrlCreateButton('Кнопка2', 1, 60, 58, 30)
$button3 = GUICtrlCreateButton('Кнопка3', 1, 90, 58, 30)
$button4 = GUICtrlCreateButton('Кнопка4', 1, 120, 58, 30)
$button5 = GUICtrlCreateButton('Кнопка5', 1, 150, 58, 30)
GUICtrlDelete($button1)
GUICtrlDelete($button2)
GUICtrlDelete($button3)
GUICtrlDelete($button4)
GUICtrlDelete($button5)
GUISetState()
While 1
Switch GUIGetMsg()
Case $button0
_Request()
Case $button1
MsgBox(4096, 'Done', 'Кнопка1')
Case $button2
MsgBox(4096, 'Done', 'Кнопка2')
Case $button3
MsgBox(4096, 'Done', 'Кнопка3')
Case $button4
MsgBox(4096, 'Done', 'Кнопка4')
Case $button5
MsgBox(4096, 'Done', 'Кнопка5')
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
Wend
Func _Request()
If $sChek = 0 Then
WinMove($sGui,'','','',62,360)
$rand = Random(1, 5, 1)
If $rand = 1 Then $button1 = GUICtrlCreateButton('Кнопка1', 1, 30, 58, 30)
If $rand = 2 Then $button2 = GUICtrlCreateButton('Кнопка2', 1, 60, 58, 30)
If $rand = 3 Then $button3 = GUICtrlCreateButton('Кнопка3', 1, 90, 58, 30)
If $rand = 4 Then $button4 = GUICtrlCreateButton('Кнопка4', 1, 120, 58, 30)
If $rand = 5 Then $button5 = GUICtrlCreateButton('Кнопка5', 1, 150, 58, 30)
$sChek = 1
Else
GUICtrlDelete($button1)
GUICtrlDelete($button2)
GUICtrlDelete($button3)
GUICtrlDelete($button4)
GUICtrlDelete($button5)
WinMove($sGui,'','','',62,32)
$sChek = 0
EndIf
EndFunc