Code: Select all
loop, 3
MsgBox("Press ''F12'' to create more!")
MsgBox("Press ''F12'' to create more!", "New Title")
msgbox, press ok to exit
exitapp
F12:: ;_____________________
MsgBox("Press ''F12'' to create more!")
return
MsgBox(Mgs, Title := "") ;_________________ v1.0 ______________
{
Static Counter := []
loop
{
if (Counter[a_index] == "")
{
Counter[a_index] := "Now_In_Use"
Gui_ID := a_index
break
}
}
gui, % "MsgBox_Function_Gui_" Gui_ID ":Default"
Gui, +HwndTemp_Win_Id +LabelMsgBox_Function_Gui
gui, add, text, +HwndTemp_Control_Id, % Mgs == "" ? "Hello" : Mgs
ControlGetPos , Ctrl_X, Ctrl_Y, Ctrl_W, Ctrl_H, , % "ahk_id" Temp_Control_Id
if (Ctrl_W < 300)
{
Win_W := 300
ControlMove, , % Win_W/2 - Ctrl_W/2, , , , % "ahk_id" Temp_Control_Id
;WinMove, % "ahk_id" Temp_Control_Id, , % Win_W/2 - Ctrl_W/2
}
if (Ctrl_H < 100)
{
Win_H := 100
;ControlMove, , , % Win_H/2 - Ctrl_H/2, , , % "ahk_id" Temp_Control_Id
;"ControlMove" does not center control correctly
WinMove, % "ahk_id" Temp_Control_Id, , , % Win_H/2 - Ctrl_H/2
}
gui, show, % "w" Win_W " h" Win_H, % Title == "" ? "MsgBox_Function_Gui_" Gui_ID : Title
return
MsgBox_Function_GuiClose: ;___
gui, destroy
Counter[RegExReplace(a_gui, "\D")] := ""
return
}