Luigi Posted September 5, 2011 Posted September 5, 2011 I try search to solve my doubt, maybe I search with wrong expressions/words. Question: the use of MsgBox pause the script's execution? Visit my repository
SandelPerieanu Posted September 5, 2011 Posted September 5, 2011 try with guicreate instead of msgbox and Opt('GUIOnEventMode',1) and it works, will not stop
JohnOne Posted September 5, 2011 Posted September 5, 2011 Yes, MsgBox() is a blocking function, as it is waiting for a response from user. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Luigi Posted September 6, 2011 Author Posted September 6, 2011 (edited) @SandelPerieanu: I try one example folow your tip/instruction with Opt('GUIOnEventMode',1) and GUISetOnEvent($GUI_EVENT_CLOSE, "_Close"), but without sucess. @JohnOne: Thanks for your reply. Detefon. Edited September 6, 2011 by detefon Visit my repository
SandelPerieanu Posted September 7, 2011 Posted September 7, 2011 with this example the script will not stop expandcollapse popup#include <Date.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('GuiOnEventMode', 1) Global $refresh, $msgbox, $label_1, $button_1, $button_2, $button_3 Global $Hour, $Mins, $Secs, $start $refresh = False $msgbox = GUICreate('MsgBox - Exemple', 140, 55, -1, -1) GUISetOnEvent($gui_event_close, '_Close') GUISetState() $label_1 = GUICtrlCreateLabel('00:00:00', 5, 5, 130, 20, 0x0201, $WS_EX_CLIENTEDGE) $button_1 = GUICtrlCreateButton('Start', 5, 30, 60, 20) GUICtrlSetOnEvent($button_1, '_Start') $button_2 = GUICtrlCreateButton('Stop', 75, 30, 60, 20) GUICtrlSetOnEvent($button_2, '_Stop') ; While 1 Sleep(1) If $refresh Then _TicksToTime(Int(TimerDiff($start)), $Hour, $Mins, $Secs) GUICtrlSetData($label_1, StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)) EndIf WEnd ; Func _Close() GUIDelete($msgbox) Exit 0 EndFunc ;==>_Close ; Func _Start() $refresh = True $start = TimerInit() EndFunc ;==>_Start ; Func _Stop() $refresh = False EndFunc ;==>_Stop
Shaggi Posted September 7, 2011 Posted September 7, 2011 Or be cool expandcollapse popup#cs Thread msgbox by Shaggi #ce #include <Array.au3> #include <WinApi.au3> #AutoIt3Wrapper_UseX64=n ThreadedMsgBox(0,"HEY","1",0) ThreadedMsgBox(0,"HEY","2",0) ThreadedMsgBox(0,"HEY","3",0) ThreadedMsgBox(0,"HEY","4",0) ThreadedMsgBox(0,"HEY","5",0) ThreadedMsgBox(0,"HEY","6",0) ThreadedMsgBox(0,"HEY","7",0) ThreadedMsgBox(0,"HEY","8",0) MsgBox(0,"HEY","Last!") Func ThreadedMsgBox($Flag,$Title,$Text,$Hwnd) Static $Count = 0 If NOT IsDeclared("Memory_Management1") Then Global $Memory_Management1[1] = [0] If NOT IsDeclared("Memory_Management2") Then Global $Memory_Management2[1] = [0] If NOT IsDeclared("Memory_ASM") Then Global $Memory_ASM[1] = [0] $Count += 1 _ArrayAdd($Memory_Management1,DllStructCreate("wchar[" & StringLen($Title) & "]")) _ArrayAdd($Memory_Management2,DllStructCreate("wchar[" & StringLen($Text) & "]")) DllStructSetData($Memory_Management1[$Count],1,$Title) DllStructSetData($Memory_Management2[$Count],1,$Text) $Address = DlLCall("Kernel32.dll","ptr","GetProcAddress","handle",_WinApi_GetModuleHandle("User32.dll"),"str","MessageBoxW") $Stub = "0x" & _ "68" & Hex(Binary($Flag),8) & _ "68" & Hex(Binary(DllStructGetPtr($Memory_Management1[$Count]))) & _ "68" & Hex(Binary(DllStructGetPtr($Memory_Management2[$Count]))) & _ "68" & Hex(Binary($Hwnd)) & _ "B8" & Hex(Binary($Address[0])) & _ "FFD0" & _ "C3" _ArrayAdd($Memory_ASM,DllStructCreate("byte[" & Int(StringLen($Stub))+1 & "]")) DllStructSetData($Memory_ASM[$Count],1,$stub) $ret = DllCall("Kernel32.dll","handle","CreateThread","int",0,"int",0,"ptr",DllStructGetPtr($Memory_ASM[$Count]),"int",0,"int",0,"int",0) Return $Ret[0] EndFUnc Func GetMsgBoxReturn($MsgBox) $iRet = DllCall("Kernel32","int","GetExitCodeThread","handle",$MsgBox,"int*",0) Return $iRet[2] EndFunc Ever wanted to call functions in another process? ProcessCall UDFConsole stuff: Console UDFC Preprocessor for AutoIt OMG
Luigi Posted September 9, 2011 Author Posted September 9, 2011 I am sorry... I try two examples without sucess... I thinking build other module for my script, and left free database's module from msgbox. If I use MsgBox, the program's looping is paused... This is not good. 8( Visit my repository
Rogue5099 Posted September 9, 2011 Posted September 9, 2011 Isn't the purpose of the MsgBox to stop script! Why would you want to keep it running without a chance to respond. If it keeps running the loop and it keeps going to the MsgBox line (or GUICreate to look like MsgBox) you will have 1,000's of them within seconds. Unless a "If WinExisit($GUIname) then" is in the loop. My projects: Inventory / Mp3 Inventory, Computer Stats
Yashied Posted September 9, 2011 Posted September 9, 2011 (edited) Look at NotifyBox from my sig. Edited September 9, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now