找回密码
 加入
搜索
查看: 2581|回复: 4

[AU3基础] (菜鸟问题)这段登录用户名和密码代码错在哪里[已解决]

[复制链接]
发表于 2010-8-11 18:34:58 | 显示全部楼层 |阅读模式
本帖最后由 faceyao 于 2010-8-11 19:17 编辑

目的是要设定只有输入用户名“abc”,和密码“123”后,点确定按钮才能登录,请问如下代码为何通不过。错在哪里(用户名和密码是固定的abc,123)。谢谢
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("同学毕业照片集", 483, 316, 296, 221)
$Pic1 = GUICtrlCreatePic("C:\Users\CEAO\Desktop\Hasnne.jpg", 0, 0, 481, 129, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlCreateInput("", 120, 168, 185, 21)
$Label1 = GUICtrlCreateLabel("用户名:", 48, 168, 72, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("密码:", 48, 200, 55, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlCreateInput("", 124, 198, 177, 21)
GUICtrlSetBkColor(-1, 0x3399FF)
$Button1 = GUICtrlCreateButton("登录", 152, 248, 121, 41)
GUICtrlSetFont(-1, 16, 400, 0, "宋体")
GUISetState(@SW_SHOW)


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

                Case $Button1
                        If $Label1.text = abc And $Label2.text = 123 Then MsgBox(0 ,"ok" ,"")
                                
                
                        
        EndSwitch
WEnd
 楼主| 发表于 2010-8-11 19:04:59 | 显示全部楼层
偶是菜鸟,哪位帮忙解答一下,关于koda的使用没有相关教程可查阅,万分感谢了
发表于 2010-8-11 19:07:18 | 显示全部楼层
$Label1 和 $Label2 一开始就用错了地方,后面的$Label1.text = abc 和 $Label2.text = 123是一错再错
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("同学毕业照片集", 483, 316, 296, 221)
$Pic1 = GUICtrlCreatePic("C:\Users\CEAO\Desktop\Hasnne.jpg", 0, 0, 481, 129, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateInput("", 120, 168, 185, 21)
GUICtrlCreateLabel("用户名:", 48, 168, 72, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("密码:", 48, 200, 55, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateInput("", 124, 198, 177, 21)
GUICtrlSetBkColor(-1, 0x3399FF)
$Button1 = GUICtrlCreateButton("登录", 152, 248, 121, 41)
GUICtrlSetFont(-1, 16, 400, 0, "宋体")
GUISetState(@SW_SHOW)


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

                        Case $Button1
                                If GUICtrlRead($Label1) == 'abc' And GUICtrlRead($Label2) == '123' Then MsgBox(0 ,"ok" ,"")
                                
                
                        
        EndSwitch
WEnd

评分

参与人数 1威望 +5 收起 理由
afan + 5

查看全部评分

 楼主| 发表于 2010-8-11 19:12:34 | 显示全部楼层
谢谢楼上的lion,已解决!
发表于 2010-8-11 19:18:25 | 显示全部楼层
楼主是学着别的语言然后来AU3上做实验的吧?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-10-3 12:36 , Processed in 0.101504 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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