Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: MessageBox Box BoxOpen
;syntax : ;======== ;MessageBoxCreate() ;opens the box ;MessageBoxTitle(Title_string) ;sets or change the box title ;MessageBox(text_string) ;displays a string in the box ;MessageBoxTime() ;displays current time + execution time in the box ;MessageBoxPause(button_text) ;pauses execution and displays "button_text" #DefineSubroutine MessageBox(text_string) if !isdefined(messagebox_window) then MessageBoxCreate() if !isdefined(messagebox_text) messagebox_text = strreplace(text_string, @crlf, @tab) else messagebox_text = strcat(messagebox_text, @tab, strreplace(text_string, @crlf, @tab)) while itemcount(messagebox_text, @tab) > 12 if !isdefined(messagebox_log) then messageBox_Log = itemextract(1, messagebox_text, @tab) else messageBox_Log = strcat(messageBox_Log, @tab, itemextract(1, messagebox_text, @tab)) messagebox_text = itemremove(1, messagebox_text, @tab) endwhile endif BoxdataClear(1, "VIDE") BoxDrawText(1, "10,10,990,990", strreplace(messagebox_text, @tab, @crlf), @TRUE, 0) RETURN #EndSubroutine #DefineSubroutine MessageBoxCreate() if !isdefined(messagebox_window) BoxesUp("200,10,800,360",@NORMAL) BoxColor(1,"42,204,191",0) BoxDrawRect(1,"0,0,1000,1000",2) BoxTextColor(1,"255,255,255") BoxTextFont(1, "", 60, 30, 34) messagebox_window = @true Boxdatatag(1, "VIDE") MessageBoxStartTime = TimeYmdHms() MessageBox(strcat("Started at: ", strsub(MessageBoxStartTime, 12, -1))) endif RETURN #EndSubroutine #DefineSubroutine MessageBoxTitle(Title_string) if !isdefined(messagebox_window) then MessageBoxCreate() BoxCaption(1,title_string) RETURN #EndSubroutine #DefineSubroutine MessageBoxPause(button_text) if !isdefined(messagebox_window) then MessageBoxCreate() MessageBoxTime() Boxdatatag(1, "BOUTON") if isdefined(messagebox_log) BoxButtonDraw(1, 1, button_text, "010,900,600,990") BoxButtonDraw(1, 2, "LOG", "650,900,990,990") beep while 1 BoxButtonWait() if BoxButtonStat(1,2) tempfile = strreplace(strlower(FileCreateTemp("mbx")), ".tmp", ".txt") fileput(tempfile, strreplace(strcat(messagebox_log, @tab, messagebox_text), @tab, @crlf)) run(tempfile, "") filedelete(tempfile) drop(tempfile) endif if BoxButtonStat(1,1) then break endwhile else BoxButtonDraw(1, 1, button_text, "300,900,700,990") beep BoxButtonWait() endif BoxdataClear(1, "BOUTON") RETURN #EndSubroutine #DefineSubroutine MessageBoxTime() if !isdefined(messagebox_window) then MessageBoxCreate() MessageBoxPauseTime = TimeYmdHms() MessageBoxDuration = TimeDiffSecs(MessageBoxPauseTime, MessageBoxStartTime) MessageBoxMin = MessageBoxDuration / 60 MessageBoxSec = strfixleft(MessageBoxDuration mod 60, "0", 2) MessageBox(strcat(@crlf, strsub(MessageBoxPauseTime, 12, -1), " (Duration: ", MessageBoxMin, ":", MessageBoxSec, ")", @crlf)) RETURN #EndSubroutine messageboxTitle("Message box function test") messagebox("This tests the functions of the MessageBox UDF.") messagebox("") messagebox("Displaying text is quite easy...") messagebox("") timedelay(5) messagebox("You can pause the execution using MessageBoxPause(caption).") messagebox(" (in this case, the caption is 'Continue...')") messageboxPause("Continue...") messagebox("") messagebox("You can also display the current time and the") messagebox("execution time of the program using MessageBoxTime().") messageboxTime() timedelay(5) messagebox("Finally, you can insert a pause at the end of your program") messagebox("allowing you to know how long it took to execute.") messagebox("") messagebox("If you displayed more lines than the box contains,") messagebox("you will be offered to view the log of what happened...") messageboxPause("Terminate")
Article ID: W16245
File Created: 2004:03:30:15:43:32
Last Updated: 2004:03:30:15:43:32