找回密码
 加入
搜索
查看: 8234|回复: 22

[GUI管理] GUI的问题,两个窗口关闭一个不关闭另一个

 火.. [复制链接]
发表于 2011-3-22 16:59:54 | 显示全部楼层 |阅读模式
本帖最后由 ac5474012 于 2011-3-22 17:23 编辑

做了一个GUI点击“停止导出”就出现一个账号密码询问框,问题是在这个框按取消就连我的主体框一起没了。请帮看看怎么只让这个密码框自己没有。
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <GuiToolbar.au3>
#include <ListViewConstants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <ToolbarConstants.au3>
#include <WindowsConstants.au3>
#include <date.au3>
#include <GuiListView.au3>
;~ ;路径------------------------------------------------------------------------------
$inifile = @ScriptDir & "\id.ini"
$id72hLJ = @ScriptDir & "\id72H.ini"
$jhLJ = @ScriptDir & "\jh.ini"
$mimainiLJ = @ScriptDir & "\mima.ini"
;~ ;路径------------------------------------------------------------------------------
#Region ### START Koda GUI section ### Form=H:\存储软件\au3\进行中\北京武警医学院数据导出\第四次导出\实验室\ID写入相关设置\用户界面1.0.kxf
$Form1_1 = GUICreate("Form1", 640, 511, 192, 125)
$Input1 = GUICtrlCreateInput("", 120, 40, 137, 21)
$Input2 = GUICtrlCreateInput("", 120, 72, 137, 21)
$Button = GUICtrlCreateButton("确认", 272, 48, 75, 41, $WS_GROUP)
$ListView = GUICtrlCreateListView("", 56, 152, 258, 254)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
$ListView_0 = GUICtrlCreateListViewItem("_NowCalc()|sText1", $ListView)
$ListView_1 = GUICtrlCreateListViewItem("INI文件不存在或文件无内容", $ListView)
$ListView_2 = GUICtrlCreateListViewItem("array[i][0]|array[i][1]", $ListView)
$Label1 = GUICtrlCreateLabel("请在此处输入ID", 16, 40, 87, 17)
$Label2 = GUICtrlCreateLabel("请重新输入", 16, 72, 64, 17)
$Label3 = GUICtrlCreateLabel("正在等待的ID", 56, 128, 75, 17)
$Group1 = GUICtrlCreateGroup("功能", 384, 32, 129, 153)
$Button1 = GUICtrlCreateButton("停止导出", 416, 64, 75, 25, $WS_GROUP)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$Button2 = GUICtrlCreateButton("关闭计算机", 416, 104, 75, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("从启计算机", 416, 144, 75, 25, $WS_GROUP)
$Button4 = GUICtrlCreateButton("刷新", 416, 416, 75, 25, $WS_GROUP)
$Button5 = GUICtrlCreateButton("从新更换IP", 416, 200, 75, 25, $WS_GROUP)
$Button6 = GUICtrlCreateButton("详情", 520, 416, 75, 25, $WS_GROUP)
$Button7 = GUICtrlCreateButton("修改", 56, 416, 75, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
Dim $StatusBar1_PartsWidth[3] = [50, 100, -1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, "", 0)
_GUICtrlStatusBar_SetText($StatusBar1, "", 1)
_GUICtrlStatusBar_SetText($StatusBar1, "", 2)
_GUICtrlStatusBar_SetBkColor($StatusBar1, 0xC8D0D4)
$Label4 = GUICtrlCreateLabel("4h", 384, 320, 16, 17)
$Label5 = GUICtrlCreateLabel("24h", 384, 352, 22, 17)
$Label6 = GUICtrlCreateLabel("72h", 384, 384, 22, 17)
$Progress4 = GUICtrlCreateProgress(424, 280, 150, 17)
$Progress1 = GUICtrlCreateProgress(424, 320, 150, 17)
$Progress2 = GUICtrlCreateProgress(424, 352, 150, 17)
$Progress3 = GUICtrlCreateProgress(424, 384, 150, 17)
$Label7 = GUICtrlCreateLabel("", 584, 320, 10, 17);4
$Label8 = GUICtrlCreateLabel("", 584, 352, 16, 17);24
$Label9 = GUICtrlCreateLabel("", 584, 384, 16, 17);72
$Label10 = GUICtrlCreateLabel("所有", 384, 280, 28, 17)
$Button8 = GUICtrlCreateButton("修改后刷新", 136, 416, 75, 25, $WS_GROUP)
$Label11 = GUICtrlCreateLabel("", 584, 280, 28, 17)
$ToolBar1 = _GUICtrlToolbar_Create($Form1_1, 0)
$ToolBar1 = _GUICtrlToolbar_Create($Form1_1, 0)
GUISetState(@SW_SHOW)
_GUICtrlListView_AddColumn($ListView, "时间", 170)
_GUICtrlListView_AddColumn($ListView, "ID号", 150)
ini()
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
        $mimapd = 0
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case -3
                        Exit
                Case $Button;确认
                        $sText1 = GUICtrlRead($Input1)
                        $sText2 = GUICtrlRead($Input2)
                        If $sText1 <> '' Or $sText2 <> '' Then
                                If $sText1 = $sText2 Then
                                        If StringIsDigit($sText1) = 1 Then
                                                GUICtrlCreateListViewItem(_NowCalc() & '|' & $sText1, $ListView)
                                                IniWrite($inifile, "全部", _NowCalc(), $sText1)
                                                GUICtrlSetData($Input1, "")
                                                GUICtrlSetData($Input2, "")
                                                MsgBox(0, "添加成功", "ID号“" & $sText1 & "”已经成功添加。")
                                        Else
                                                MsgBox(0, "错误", "输入的内容中含有非数字字符,请核对后从新输入。")
                                        EndIf
                                Else
                                        MsgBox(0, "错误", "两次输入的信息不同,请核对后从新输入。")

                                EndIf
                        EndIf
                Case $Button1;停止
;~                         $mimapdt = mimaK($mimainiLJ)
                        If mimaK($mimainiLJ) =  1 Then IniWrite($jhLJ, "开关信息", "停止导出", 1)
                Case $Button2;关闭计算机
                        $mimapd = mimaK($mimainiLJ)
;~                         If $msg = $GUI_EVENT_CLOSE
                        If $mimapd =  1 Then IniWrite($jhLJ, "开关信息", "关闭计算机", 1)
                Case $Button3;从启计算机
                        $mimapd = mimaK($mimainiLJ)
                        If $mimapd =  1 Then IniWrite($jhLJ, "开关信息", "从启计算机", 1)
                Case $Button4;刷新
                        $4hjd = jd4()
                        GUICtrlSetData($Progress1, $4hjd)
                        GUICtrlSetData($Label7, $4hjd)
                        $24hjd = jd24()
                        GUICtrlSetData($Progress2, $24hjd)
                        GUICtrlSetData($Label8, $24hjd)
                        $72hjd = jd72()
                        GUICtrlSetData($Progress3, $72hjd)
                        GUICtrlSetData($Label9, $72hjd)
                        $suoyou = $4hjd + $24hjd + $72hjd
                        GUICtrlSetData($Progress4, $suoyou)
                        GUICtrlSetData($Label11, $suoyou)
                Case $Button5;从新更换IP
                Case $Button6;详情
                Case $Button7;修改
                        ShellExecute($inifile)
                Case $Button8;修改后刷新
                        _GUICtrlListView_DeleteAllItems($ListView)
                        ini()
        EndSwitch
WEnd



Func ini()
        ;_GUICtrlListView_DeleteAllItems($ListView)
        $array = IniReadSection($inifile, "全部")
        If @error Then
                GUICtrlCreateListViewItem("INI文件不存在或文件无内容", $ListView)
        Else
                For $i = 1 To $array[0][0]
                        GUICtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1], $ListView)
                Next
        EndIf
EndFunc   ;==>ini

Func jd4()
        $4hls = 0
        $4h = IniReadSection($id72hLJ, "4h")
        If @error Then
                MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
        Else
                For $i = 1 To $4h[0][0]
;~         MsgBox(4096, "", "关键字:" & $4h[$i][0] & @CRLF & "数值:" & $4h[$i][1])
                        $4hls = $4hls + 1
                Next
                Return $4hls
        EndIf
EndFunc   ;==>jd4

Func jd24()
        $24hls = 0
        $4h = IniReadSection($id72hLJ, "24h")
        If @error Then
                MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
        Else
                For $i = 1 To $4h[0][0]
;~         MsgBox(4096, "", "关键字:" & $4h[$i][0] & @CRLF & "数值:" & $4h[$i][1])
                        $24hls = $24hls + 1
                Next
                Return $24hls
        EndIf
EndFunc   ;==>jd24

Func jd72()
        $72hls = 0
        $4h = IniReadSection($id72hLJ, "72h")
        If @error Then
                MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
        Else
                For $i = 1 To $4h[0][0]
;~         MsgBox(4096, "", "关键字:" & $4h[$i][0] & @CRLF & "数值:" & $4h[$i][1])
                        $72hls = $72hls + 1
                Next
                Return $72hls
        EndIf
EndFunc   ;==>jd72


Func mimaK($mimaLJ)
        ;操作说明 mimaK(Ini文件路径)
;~ ;返回说明:错误无返回,正确返回1

        #include <ButtonConstants.au3>
        #include <EditConstants.au3>
        #include <GUIConstantsEx.au3>
        #include <StaticConstants.au3>
        #include <WindowsConstants.au3>
        #Region ### START Koda GUI section ### Form=
        $Form2 = GUICreate("密码对话框", 337, 118, -1, -1)
        GUISetIcon("D:\008.ico")
        $zhanghaoSR = GUICtrlCreateInput("", 88, 16, 233, 21, BitOR($ES_LEFT, $ES_AUTOHSCROLL))
        $mimaSR = GUICtrlCreateInput("", 88, 48, 233, 21, BitOR($ES_LEFT, $ES_AUTOHSCROLL))
        $ButtonOk = GUICtrlCreateButton("确定(&O)", 86, 80, 75, 25, 0)
        $ButtonCancel = GUICtrlCreateButton("取消(&C)", 167, 80, 75, 25, 0)
        $EnterPassLabel = GUICtrlCreateLabel("请输入账号:", 8, 20, 76, 17)
        $Label1 = GUICtrlCreateLabel("请输入密码:", 8, 52, 76, 17)
        GUISetState(@SW_SHOW)
        #EndRegion ### END Koda GUI section ###
        While 1
                Return('0')
                $nMsg = GUIGetMsg()
                Switch $nMsg
                        Case $GUI_EVENT_CLOSE
                                Exit
                        Case $ButtonOk
                                
                                $zhanghaoZ = GUICtrlRead($zhanghaoSR)
                                $mimaZ = GUICtrlRead($mimaSR)
                                If $zhanghaoZ = "" Then
                                        MsgBox(0,"","请输入您的账号")
                                Else        
                                $m = mima($zhanghaoZ, $mimaZ, $mimaLJ)
                                If $m = 1 Then
                                        Return ('1')
                                        ExitLoop
                                EndIf
                                If $m = 2 Then MsgBox(0, "", "你的账号错误")
                                If $m = 3 Then MsgBox(0, "", "你的密码错误")
                                If $m = 0 Then MsgBox(0, "", "意外错误")
                                EndIf
                        Case $ButtonCancel
                                
                EndSwitch
        WEnd
EndFunc   ;==>mimaK

Func mima($ZH, $MM, $mimaLJ)
;操作说明 mima(账号, 密码,Ini文件路径)
;~ ;返回说明:0=意外错误,1=正确,2=账号错误,3=密码错误
        $mima = 0
        $zhbs = 0
        $mmbs = 0
        $varmima = IniReadSection($mimaLJ, "密码=账号")
        If @error Then
                MsgBox(4096, "", "发生错误,密码配置文件不能被找到,请联系管理员。")
        Else
                For $i = 1 To $varmima[0][0]
;~                         MsgBox(4096, "", "关键字:" & $varmima[$i][0] & @CRLF & "数值:" & $varmima[$i][1])
                        If $ZH = $varmima[$i][0] Then
                                If $MM = $varmima[$i][1] Then
                                        $mima = 1
                                Else
                                        $mmbs = 1
                                EndIf
                        Else
                                $zhbs = 1
                        EndIf
                Next

                If $mima = 1 Then
                        Return ('1')
                ElseIf $mmbs = 1 Then
                        Return ('3')
                Else
                        If $zhbs <> 0 Then
                                Return ('2')
                        Else
                                Return ('0')
                        EndIf
                EndIf
        EndIf
EndFunc   ;==>mima
        

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-3-22 17:06:49 | 显示全部楼层
用GUIDelete 删除密码窗口
发表于 2011-3-22 17:08:39 | 显示全部楼层
帮助里看看$msg=guigetmsg(1)的意思
 楼主| 发表于 2011-3-22 17:08:51 | 显示全部楼层
回复 2# xyold1

不行啊,那样就不能再打开窗口了。
 楼主| 发表于 2011-3-22 17:11:41 | 显示全部楼层
回复 3# netegg

返回一个含有事件及扩展信息的数组。,哥们是我理解错了,还是你理解错了~
发表于 2011-3-22 17:14:51 | 显示全部楼层
本帖最后由 netegg 于 2011-3-22 17:16 编辑

$msg=guigetmsg(1)可以用来确定关闭消息的来源,不是就一个子窗体一个主窗体吗,关闭来源于主,一起关,来源于子,只关子不关主
发表于 2011-3-22 17:16:05 | 显示全部楼层
你试试这个
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <GuiToolbar.au3>
#include <ListViewConstants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <ToolbarConstants.au3>
#include <WindowsConstants.au3>
#include <date.au3>
#include <GuiListView.au3>
;~ ;路径------------------------------------------------------------------------------
$inifile = @ScriptDir & "\id.ini"
$id72hLJ = @ScriptDir & "\id72H.ini"
$jhLJ = @ScriptDir & "\jh.ini"
$mimainiLJ = @ScriptDir & "\mima.ini"
;~ ;路径------------------------------------------------------------------------------
#Region ### START Koda GUI section ### Form=H:\存储软件\au3\进行中\北京武警医学院数据导出\第四次导出\实验室\ID写入相关设置\用户界面1.0.kxf
$Form1_1 = GUICreate("Form1", 640, 511, 192, 125)
$Input1 = GUICtrlCreateInput("", 120, 40, 137, 21)
$Input2 = GUICtrlCreateInput("", 120, 72, 137, 21)
$Button = GUICtrlCreateButton("确认", 272, 48, 75, 41, $WS_GROUP)
$ListView = GUICtrlCreateListView("", 56, 152, 258, 254)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
$ListView_0 = GUICtrlCreateListViewItem("_NowCalc()|sText1", $ListView)
$ListView_1 = GUICtrlCreateListViewItem("INI文件不存在或文件无内容", $ListView)
$ListView_2 = GUICtrlCreateListViewItem("array[0]|array[1]", $ListView)
$Label1 = GUICtrlCreateLabel("请在此处输入ID", 16, 40, 87, 17)
$Label2 = GUICtrlCreateLabel("请重新输入", 16, 72, 64, 17)
$Label3 = GUICtrlCreateLabel("正在等待的ID", 56, 128, 75, 17)
$Group1 = GUICtrlCreateGroup("功能", 384, 32, 129, 153)
$Button1 = GUICtrlCreateButton("停止导出", 416, 64, 75, 25, $WS_GROUP)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$Button2 = GUICtrlCreateButton("关闭计算机", 416, 104, 75, 25, $WS_GROUP)
$Button3 = GUICtrlCreateButton("从启计算机", 416, 144, 75, 25, $WS_GROUP)
$Button4 = GUICtrlCreateButton("刷新", 416, 416, 75, 25, $WS_GROUP)
$Button5 = GUICtrlCreateButton("从新更换IP", 416, 200, 75, 25, $WS_GROUP)
$Button6 = GUICtrlCreateButton("详情", 520, 416, 75, 25, $WS_GROUP)
$Button7 = GUICtrlCreateButton("修改", 56, 416, 75, 25, $WS_GROUP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
Dim $StatusBar1_PartsWidth[3] = [50, 100, -1]
_GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar1, "", 0)
_GUICtrlStatusBar_SetText($StatusBar1, "", 1)
_GUICtrlStatusBar_SetText($StatusBar1, "", 2)
_GUICtrlStatusBar_SetBkColor($StatusBar1, 0xC8D0D4)
$Label4 = GUICtrlCreateLabel("4h", 384, 320, 16, 17)
$Label5 = GUICtrlCreateLabel("24h", 384, 352, 22, 17)
$Label6 = GUICtrlCreateLabel("72h", 384, 384, 22, 17)
$Progress4 = GUICtrlCreateProgress(424, 280, 150, 17)
$Progress1 = GUICtrlCreateProgress(424, 320, 150, 17)
$Progress2 = GUICtrlCreateProgress(424, 352, 150, 17)
$Progress3 = GUICtrlCreateProgress(424, 384, 150, 17)
$Label7 = GUICtrlCreateLabel("", 584, 320, 10, 17);4
$Label8 = GUICtrlCreateLabel("", 584, 352, 16, 17);24
$Label9 = GUICtrlCreateLabel("", 584, 384, 16, 17);72
$Label10 = GUICtrlCreateLabel("所有", 384, 280, 28, 17)
$Button8 = GUICtrlCreateButton("修改后刷新", 136, 416, 75, 25, $WS_GROUP)
$Label11 = GUICtrlCreateLabel("", 584, 280, 28, 17)
$ToolBar1 = _GUICtrlToolbar_Create($Form1_1, 0)
$ToolBar1 = _GUICtrlToolbar_Create($Form1_1, 0)
GUISetState(@SW_SHOW)
_GUICtrlListView_AddColumn($ListView, "时间", 170)
_GUICtrlListView_AddColumn($ListView, "ID号", 150)
ini()
GUISetState()
#EndRegion ### END Koda GUI section ###

While 1
        $mimapd = 0
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case -3
                        Exit
                Case $Button;确认
                        $sText1 = GUICtrlRead($Input1)
                        $sText2 = GUICtrlRead($Input2)
                        If $sText1 <> '' Or $sText2 <> '' Then
                                If $sText1 = $sText2 Then
                                        If StringIsDigit($sText1) = 1 Then
                                                GUICtrlCreateListViewItem(_NowCalc() & '|' & $sText1, $ListView)
                                                IniWrite($inifile, "全部", _NowCalc(), $sText1)
                                                GUICtrlSetData($Input1, "")
                                                GUICtrlSetData($Input2, "")
                                                MsgBox(0, "添加成功", "ID号“" & $sText1 & "”已经成功添加。")
                                        Else
                                                MsgBox(0, "错误", "输入的内容中含有非数字字符,请核对后从新输入。")
                                        EndIf
                                Else
                                        MsgBox(0, "错误", "两次输入的信息不同,请核对后从新输入。")

                                EndIf
                        EndIf
                Case $Button1;停止
;~                         $mimapdt = mimaK($mimainiLJ)
                        If mimaK($mimainiLJ) =  1 Then IniWrite($jhLJ, "开关信息", "停止导出", 1)
                Case $Button2;关闭计算机
                        $mimapd = mimaK($mimainiLJ)
                        If $mimapd =  1 Then IniWrite($jhLJ, "开关信息", "关闭计算机", 1)
                Case $Button3;从启计算机
                        $mimapd = mimaK($mimainiLJ)
                        If $mimapd =  1 Then IniWrite($jhLJ, "开关信息", "从启计算机", 1)
                Case $Button4;刷新
                        $4hjd = jd4()
                        GUICtrlSetData($Progress1, $4hjd)
                        GUICtrlSetData($Label7, $4hjd)
                        $24hjd = jd24()
                        GUICtrlSetData($Progress2, $24hjd)
                        GUICtrlSetData($Label8, $24hjd)
                        $72hjd = jd72()
                        GUICtrlSetData($Progress3, $72hjd)
                        GUICtrlSetData($Label9, $72hjd)
                        $suoyou = $4hjd + $24hjd + $72hjd
                        GUICtrlSetData($Progress4, $suoyou)
                        GUICtrlSetData($Label11, $suoyou)
                Case $Button5;从新更换IP
                Case $Button6;详情
                Case $Button7;修改
                        ShellExecute($inifile)
                Case $Button8;修改后刷新
                        _GUICtrlListView_DeleteAllItems($ListView)
                        ini()
        EndSwitch
WEnd



Func ini()
        ;_GUICtrlListView_DeleteAllItems($ListView)
        $array = IniReadSection($inifile, "全部")
        If @error Then
                GUICtrlCreateListViewItem("INI文件不存在或文件无内容", $ListView)
        Else
                For $i = 1 To $array[0][0]
                        GUICtrlCreateListViewItem($array[$i][0] & "|" & $array[$i][1], $ListView)
                Next
        EndIf
EndFunc   ;==>ini

Func jd4()
        $4hls = 0
        $4h = IniReadSection($id72hLJ, "4h")
        If @error Then
                MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
        Else
                For $i = 1 To $4h[0][0]
;~         MsgBox(4096, "", "关键字:" & $4h[$i][0] & @CRLF & "数值:" & $4h[$i][1])
                        $4hls = $4hls + 1
                Next
                Return $4hls
        EndIf
EndFunc   ;==>jd4

Func jd24()
        $24hls = 0
        $4h = IniReadSection($id72hLJ, "24h")
        If @error Then
                MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
        Else
                For $i = 1 To $4h[0][0]
;~         MsgBox(4096, "", "关键字:" & $4h[$i][0] & @CRLF & "数值:" & $4h[$i][1])
                        $24hls = $24hls + 1
                Next
                Return $24hls
        EndIf
EndFunc   ;==>jd24

Func jd72()
        $72hls = 0
        $4h = IniReadSection($id72hLJ, "72h")
        If @error Then
                MsgBox(4096, "", "发生错误,可能目标文件并非标准的INI文件.")
        Else
                For $i = 1 To $4h[0][0]
;~         MsgBox(4096, "", "关键字:" & $4h[$i][0] & @CRLF & "数值:" & $4h[$i][1])
                        $72hls = $72hls + 1
                Next
                Return $72hls
        EndIf
EndFunc   ;==>jd72


Func mimaK($mimaLJ)
        ;操作说明 mimaK(Ini文件路径)
;~ ;返回说明:错误无返回,正确返回1

        #include <ButtonConstants.au3>
        #include <EditConstants.au3>
        #include <GUIConstantsEx.au3>
        #include <StaticConstants.au3>
        #include <WindowsConstants.au3>
        #Region ### START Koda GUI section ### Form=
        $Form2 = GUICreate("密码对话框", 337, 118, -1, -1)
        GUISetIcon("D:\008.ico")
        $zhanghaoSR = GUICtrlCreateInput("", 88, 16, 233, 21, BitOR($ES_LEFT, $ES_AUTOHSCROLL))
        $mimaSR = GUICtrlCreateInput("", 88, 48, 233, 21, BitOR($ES_LEFT, $ES_AUTOHSCROLL))
        $ButtonOk = GUICtrlCreateButton("确定(&O)", 86, 80, 75, 25, 0)
        $ButtonCancel = GUICtrlCreateButton("取消(&C)", 167, 80, 75, 25, 0)
        $EnterPassLabel = GUICtrlCreateLabel("请输入账号:", 8, 20, 76, 17)
        $Label1 = GUICtrlCreateLabel("请输入密码:", 8, 52, 76, 17)
        GUISetState(@SW_SHOW)
        #EndRegion ### END Koda GUI section ###
        While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                        Case $GUI_EVENT_CLOSE
                                Exit
                        Case $ButtonOk
                                
                                $zhanghaoZ = GUICtrlRead($zhanghaoSR)
                                $mimaZ = GUICtrlRead($mimaSR)
                                If $zhanghaoZ = "" Then
                                        MsgBox(0,"","请输入您的账号")
                                Else        
                                $m = mima($zhanghaoZ, $mimaZ, $mimaLJ)
                                If $m = 1 Then
                                        Return ('1')
                                        ExitLoop
                                EndIf
                                If $m = 2 Then MsgBox(0, "", "你的账号错误")
                                If $m = 3 Then MsgBox(0, "", "你的密码错误")
                                If $m = 0 Then MsgBox(0, "", "意外错误")
                                EndIf
                        Case $ButtonCancel
GUIDelete($Form2)
ExitLoop
EndSwitch
        WEnd
EndFunc   ;==>mimaK

Func mima($ZH, $MM, $mimaLJ)
;操作说明 mima(账号, 密码,Ini文件路径)
;~ ;返回说明:0=意外错误,1=正确,2=账号错误,3=密码错误
        $mima = 0
        $zhbs = 0
        $mmbs = 0
        $varmima = IniReadSection($mimaLJ, "密码=账号")
        If @error Then
                MsgBox(4096, "", "发生错误,密码配置文件不能被找到,请联系管理员。")
        Else
                For $i = 1 To $varmima[0][0]
;~                         MsgBox(4096, "", "关键字:" & $varmima[$i][0] & @CRLF & "数值:" & $varmima[$i][1])
                        If $ZH = $varmima[$i][0] Then
                                If $MM = $varmima[$i][1] Then
                                        $mima = 1
                                Else
                                        $mmbs = 1
                                EndIf
                        Else
                                $zhbs = 1
                        EndIf
                Next

                If $mima = 1 Then
                        Return ('1')
                ElseIf $mmbs = 1 Then
                        Return ('3')
                Else
                        If $zhbs <> 0 Then
                                Return ('2')
                        Else
                                Return ('0')
                        EndIf
                EndIf
        EndIf
EndFunc   ;==>mima
        
发表于 2011-3-22 17:17:34 | 显示全部楼层
另外,以后发贴代码直接贴出来吧,下载附件是要花银子的

评分

参与人数 1金钱 +25 收起 理由
ac5474012 + 25 真不知道

查看全部评分

发表于 2011-3-22 17:18:08 | 显示全部楼层
回复 7# xyold1
在脚本中间创建gui,有些样式是没法用的
 楼主| 发表于 2011-3-22 17:21:36 | 显示全部楼层
本帖最后由 ac5474012 于 2011-3-22 17:22 编辑

回复 9# netegg

你是说我不能用自定义函数做这个?但是好乱啊
 楼主| 发表于 2011-3-22 17:22:22 | 显示全部楼层
回复 7# xyold1

你这个还是不行啊
发表于 2011-3-22 17:26:59 | 显示全部楼层
点击“停止导出” 账号密码询问框,按取消后 主体框还在啊,怎么会不行呢,另外蛋蛋的回贴也不是很明白
唉,基础不好
发表于 2011-3-22 17:30:33 | 显示全部楼层
我修改了下,你试试吧

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-3-22 17:35:41 | 显示全部楼层
你那里主窗体消失了吗,我这可以的啊
 楼主| 发表于 2011-3-22 17:45:33 | 显示全部楼层
回复 14# xyold1

点击密码窗口右上角的叉就两个窗口都关闭了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-11 18:17 , Processed in 0.096384 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表