Jump to content

autoit crashing on some gui


Recommended Posts

Func MainGui()
    Dim $mg_i_SizeOf[2]
    Dim $mg_i_CoordOf[2]
    Dim $mg_i_sectest
    Dim $mg_i_counter
    Dim $mg_i_timeset=DefTime()
    Dim $mg_g_GGM
    Dim $mg_g_output[6]
    Dim $mg_ctrl_TimeLabel
    Dim $mg_ctrl_InArr[6]
    Dim $mg_ctrl_okbutton
    Dim $mg_ctrl_optbutton
    Dim $mg_ctrl_aboutbutton

    Dim $mg_acc_acc[2]=["{ENTER}",$mg_ctrl_okbutton]

    $mg_i_SizeOf[0]=IniRead("OPT.ini","OPT","MGSIZEX",500)
    $mg_i_SizeOf[1]=IniRead("OPT.ini","OPT","MGSIZEY",350)
    $mg_i_CoordOf[0]=IniRead("OPT.ini","OPT","COORDX",(@DesktopWidth/2)-($mg_i_SizeOf[0]/2))
    $mg_i_CoordOf[1]=IniRead("OPT.ini","OPT","COORDY",(@DesktopHeight/2)-($mg_i_SizeOf[1]/2))

    $mg_guihandle=GUICreate("Work log",$mg_i_SizeOf[0],$mg_i_SizeOf[1],$mg_i_CoordOf[0],$mg_i_CoordOf[1],BitOR($WS_BORDER,$WS_VISIBLE,$WS_CAPTION,$WS_SYSMENU))
    $mg_ctrl_TimeLabel=GUICtrlCreateLabel("",105,25,300,20)
    GUICtrlCreateLabel("Start:",25,60,25,20)
    $mg_ctrl_InArr[0]=GUICtrlCreateInput("",55,58,50,20,$ES_NUMBER)
    GUICtrlCreateLabel(":",110,60,10,20)
    $mg_ctrl_InArr[1]=GUICtrlCreateInput("",120,58,50,20,$ES_NUMBER)
    GUICtrlCreateLabel("End:",28,90,60,20)
    $mg_ctrl_InArr[2]=GUICtrlCreateInput("",55,88,50,20,$ES_NUMBER)
    GUICtrlCreateLabel(":",110,90,10,20)
    $mg_ctrl_InArr[3]=GUICtrlCreateInput("",120,88,50,20,$ES_NUMBER)
    GUICtrlCreateLabel("File name:",25,140,50,20)
    $mg_ctrl_InArr[4]=GUICtrlCreateInput(@MON&"."&@YEAR&".txt",75,138,95,20)
    $mg_ctrl_okbutton=GUICtrlCreateButton("OK",175,55,105,105)
    $mg_ctrl_optbutton=GUICtrlCreateButton("Options",25,165,50,20)
    $mg_ctrl_aboutbutton=GUICtrlCreateButton("About",85,165,50,20)

    GUICtrlSetData($mg_ctrl_InArr[0],$mg_i_timeset[0])
    GUICtrlSetData($mg_ctrl_InArr[1],"00")
    GUICtrlSetData($mg_ctrl_InArr[2],$mg_i_timeset[1])
    GUICtrlSetData($mg_ctrl_InArr[3],"00")
    GUISetAccelerators($mg_acc_acc,$mg_guihandle)

    While 1=1
        Sleep(20)
        If $mg_i_sectest<>@SEC Then
            GUICtrlSetData($mg_ctrl_TimeLabel,"Welcome. Today is the "&@MDAY&"."&@MON&"."&@YEAR&". The time is "&@HOUR&":"&@MIN&":"&@SEC)
            $mg_i_sectest=@SEC
        EndIf
        $mg_g_GGM=GUIGetMsg()
        Switch $mg_g_GGM
            Case $mg_ctrl_okbutton
                $mg_g_output[0]=1
                For $mg_i_counter=1 To 5
                    $mg_g_output[$mg_i_counter]=GUICtrlRead($mg_ctrl_InArr[$mg_i_counter-1])
                Next

                Return $mg_g_output
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch

    WEnd
EndFunc

i wrote this gui.

apparently, it's too awesome for autoit to accept it because it crashes as soon as i try to call it.

when i remove it, everything works ok.

i have no idea what caused this because it worked earlier too.

i have attached my entire project, in case the problem is not with MainGui().

Salary Log.rar

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...