chasedream 发表于 2008-6-15 18:57:28

关于两个GUI窗口请教?

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.12.0
Author:         myName

Script Function:
        Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <string.au3>

$g_szVersion = "My_bxp"
If WinExists($g_szVersion) Then Exit ; 此脚本已经运行了
AutoItWinSetTitle($g_szVersion)

fileinstall("top.jpg",@tempdir &"\top.jpg")

$passwrad = _StringEncrypt(1,"admin","chasedream",1)
if not FileExists(@scriptdir &"\pz.ini") Then
        iniwrite(@ScriptDir &"\pz.ini","user","user","admin")
    iniwrite(@ScriptDir &"\pz.ini","user","pass",$passwrad)
EndIf

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Bxp_Log in", 311, 119, 193, 125)
GUICtrlCreateLabel("User:", 128, 16, 29, 17)
GUICtrlCreateLabel("Pass:", 128, 48, 30, 17)
$user = GUICtrlCreateInput("", 168, 16, 121, 21)
$pass = GUICtrlCreateInput("", 168, 48, 121, 21,$ES_PASSWORD)
$log_in = GUICtrlCreateButton("Log me In", 232, 80, 59, 25, 0)
GUICtrlCreatePic(@tempdir &"\top.jpg", 8, 8, 100, 100, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
        Case $GUI_EVENT_CLOSE
                Exit
        Case $log_in
                login()
        EndSwitch
WEnd

Func login()
$user_a = iniread(@scriptdir &"\pz.ini","user","user","")
$pass_a = iniread(@scriptdir &"\pz.ini","user","pass","")
$pass_c = _StringEncrypt(0,$pass_a,"chasedream",1)
$user_b = GUICtrlRead($user)
$pass_b = GUICtrlRead($pass)
if $user_a = $user_b or $pass_c = $pass_b Then
        games()
        Else
        MsgBox("16","提示:","帐号或密码错误,请重新输入!")
EndIf
EndFunc

Func games()
        #Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Bxp_游戏管理", 429, 228, 193, 125)
$Button1 = GUICtrlCreateButton("磁盘加载", 24, 24, 75, 25, 0)
$Button2 = GUICtrlCreateButton("游戏升级", 24, 64, 75, 25, 0)
$Button3 = GUICtrlCreateButton("游戏目录", 24, 104, 75, 25, 0)
$Button4 = GUICtrlCreateButton("游戏菜单", 24, 144, 75, 25, 0)
GUICtrlCreateEdit("", 112, 24, 289, 185)
$Button5 = GUICtrlCreateButton("退出程序", 24, 184, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button5
                        Exit

        EndSwitch
WEnd
        EndFunc


请问,需要怎么更改,才能使登陆成功以后,出现第2个GUI,第一个GUI,消失?

[ 本帖最后由 chasedream 于 2008-6-16 19:42 编辑 ]

bing614 发表于 2008-6-15 19:25:32

GUIDelete ($Form1)

chasedream 发表于 2008-6-15 20:00:44

感谢,感谢,测试以后,成功就给你加分.
页: [1]
查看完整版本: 关于两个GUI窗口请教?