Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Аватара для Creat0R

Must AutoIt


Сообщения: 3054
Благодарности: 1009

Профиль | Сайт | Отправить PM | Цитировать


Цитата Smokie_id11243755:
не нашел 'msgbox с отсчетом' вот и решил создать »
А если поискать просто по MsgBox?

Цитата Smokie_id11243755:
можно ли сделать как нибудь без создания нового файла? и чтобы прям на кнопке отсчет шел? »
Можно.

Код: Выделить весь код
#Include <GUIConstantsEx.au3>
#Include <ButtonConstants.au3>
#Include <WindowsConstants.au3>

$Title = "My Custom MsgBox"
$Prompt = "Are you sure?"
$CheckBoxText = "Don't show again"

$hWnd = WinGetHandle("")

$Ask = _GUIMsgBox(256+36, 2, $Title, $Prompt, 330, 120, $CheckBoxText, 10, $hWnd, "OK", "Cancel")

$CheckBitAnd = BitAND($Ask, 8)

$Var = "Pressed "

Select
	Case $Ask - $CheckBitAnd = 1
		$Var &= "'OK'"
	Case $Ask - $CheckBitAnd = 6
		$Var &= "'Yes' or 'OK'"
	Case $Ask - $CheckBitAnd = 7
		$Var &= "'No' or 'Cancel'"
EndSelect

If $CheckBitAnd = 8 Then $Var &= @LF & "And CheckBox <" & $CheckBoxText & "> was Checked"

_GUIMsgBox(64, 1, "Message", "Returned values:" & @LF & @LF & $Var)

Func _GUIMsgBox($iIcoType,$iBtnNum,$sTitle,$sTxt,$iW=350,$iH=130,$sCB_Txt=-1,$iTimer=-1,$hWnd=0,$sB1Txt=-1,$sB2Txt=-1,$nExStyle=-1)
	Local $nYes_Button, $nNo_Button, $nOK_Button, $nCheckBox=-1, $hMsgBox_GUI, $iGuiHeight = $iH
	Local $nStyle = BitOR($WS_CAPTION, $WS_POPUP)
	Local $nMsg, $iReturnVal = 0
	Local $nDefButton, $sDefButtonText = $sB1Txt, $iCounter
	Local $iMessageBeep = -1, $iIcon_Id = 102
	
	Local $iOld_Opt_GOEM = Opt('GuiOnEventMode', 0)
	Local $iOld_Opt_GCOE = Opt('GUICloseOnESC', 0)
	
	If $iBtnNum = 1 Then $nStyle = BitOR($nStyle, $WS_SYSMENU)
	
	If BitAND($iIcoType, 262144) Then
		If $nExStyle = -1 Or $nExStyle = Default Then $nExStyle = 0
		$nExStyle = BitOR($nExStyle, $WS_EX_TOPMOST)
	EndIf
	
	If $sCB_Txt <> -1 Then $iGuiHeight += 25
	
	If $sB1Txt = -1 Then $sB1Txt = 'OK'
	If $sB2Txt = -1 Then $sB2Txt = 'Cancel'
	
	If IsHWnd($hWnd) Then WinSetState($hWnd, "", @SW_DISABLE)
	
	$hMsgBox_GUI = GUICreate($sTitle, $iW, $iGuiHeight, -1, -1, $nStyle, $nExStyle, $hWnd)
	
	Select
		Case $iIcoType = 16 Or $iIcoType = 16 + 256
			$iIcon_Id = 103
			$iMessageBeep = 0x00000010
		Case $iIcoType = 32 Or $iIcoType = 32 + 256
			$iIcon_Id = 102
			$iMessageBeep = 0x00000020
		Case $iIcoType = 48 Or $iIcoType = 48 + 256
			$iIcon_Id = 101
			$iMessageBeep = 0x00000030
		Case $iIcoType = 64 Or $iIcoType = 64 + 256
			$iIcon_Id = 104
			$iMessageBeep = 0x00000040
	EndSelect
	
	GUICtrlCreateIcon('user32.dll', $iIcon_Id, 10, 10)
	GUICtrlCreateLabel($sTxt, 70, 15, $iW-80, $iH-50)
	
	Select
		Case $iBtnNum = 2
			$nYes_Button = GUICtrlCreateButton($sB1Txt, ($iW/2)-90, $iH-35, 70, 20, $BS_DEFPUSHBUTTON)
			$nDefButton = $nYes_Button
			
			Local $iSecButtDeffStyle = 0
			If BitAND($iIcoType, 256) Then $iSecButtDeffStyle = $BS_DEFPUSHBUTTON
			
			$nNo_Button = GUICtrlCreateButton($sB2Txt, ($iW/2)+20, $iH-35, 70, 20, $iSecButtDeffStyle)
			If BitAND($iIcoType, 256) Then $nDefButton = $nNo_Button
		Case Else
			$nOK_Button = GUICtrlCreateButton($sB1Txt, ($iW-70)/2, $iH-35, 70, 20)
			GUICtrlSetState($nOK_Button, $GUI_ONTOP)
			$nDefButton = $nOK_Button
	EndSelect
	
	If $sCB_Txt <> -1 Then $nCheckBox = GUICtrlCreateCheckbox($sCB_Txt, 15, $iH-10)
	
	GUISetState(@SW_SHOW, $hMsgBox_GUI)
	DllCall("user32.dll", "int", "MessageBeep", "int", $iMessageBeep)
	
	If $iTimer > 0 Then
		$iCounter = $iTimer
		$iTimer = TimerInit()
		$sDefButtonText = GUICtrlRead($nDefButton)
		GUICtrlSetData($nDefButton, $sDefButtonText & ' (' & $iCounter & ')')
	EndIf
	
	While 1
		$nMsg = GUIGetMsg()
		
		If $iTimer > 0 And TimerDiff($iTimer) >= 1000 Then
			$iTimer = TimerInit()
			$iCounter -= 1
			GUICtrlSetData($nDefButton, $sDefButtonText & ' (' & $iCounter & ')')
			If $iCounter < 0 Then $nMsg = $nDefButton
		EndIf
		
		Select
			Case $iBtnNum = 2 And $nMsg = $nYes_Button
				$iReturnVal = 6
				ExitLoop
			Case $iBtnNum = 2 And $nMsg = $nNo_Button
				$iReturnVal = 7
				ExitLoop
			Case $nMsg = -3 Or ($nMsg = $nOK_Button And $iBtnNum <> 2)
				$iReturnVal = 1
				ExitLoop
		EndSelect
	Wend
	
	If GUICtrlRead($nCheckBox) = 1 Then $iReturnVal += 8
	
	If IsHWnd($hWnd) Then WinSetState($hWnd, "", @SW_ENABLE)
	GUIDelete($hMsgBox_GUI)
	
	If IsHWnd($hWnd) Then GUISwitch($hWnd)
	
	Opt('GuiOnEventMode', $iOld_Opt_GOEM)
	Opt('GUICloseOnESC', $iOld_Opt_GCOE)
	
	Return $iReturnVal
EndFunc

-------
“Сделай так просто, как возможно, но не проще этого.”... “Ты никогда не решишь проблему, если будешь думать так же, как те, кто её создал.”

Альберт Эйнштейн

P.S «Не оказываю техподдержку через ПМ/ICQ, и по email - для этого есть форум. ©»

http://creator-lab.ucoz.ru/Images/Icons/autoit_icon.png Русское сообщество AutoIt | http://creator-lab.ucoz.ru/Images/Ic...eator_icon.png CreatoR's Lab | http://creator-lab.ucoz.ru/Images/Icons/oac_icon.png Opera AC Community

Это сообщение посчитали полезным следующие участники:

Отправлено: 17:09, 30-08-2010 | #7