xrzmjz 发表于 2010-7-6 11:56:04

奇怪的错误,请高人帮忙调试

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
Dim $const=1

While $const=1
HotKeySet("F10","password")
        Func password()
               
                $Form1 = GUICreate("请输入密码",175, 2)
                $Input1 = GUICtrlCreateInput("", 8, 8)
                GUISetState(@SW_SHOW)
               
                While 1
                        $nMsg = GUIGetMsg()
                       
                        Switch $nMsg
                                Case $GUI_EVENT_CLOSE
                                        Exit
                        EndSwitch
                       
                WEnd
               
        EndFunc
WEnd

xrzmjz 发表于 2010-7-6 11:57:44

语法上没发现错误
但是无法通过编译
请高手帮忙调试

xrzmjz 发表于 2010-7-6 12:00:28

语法上我检查了多遍
确定不存在任何错误
但是总是无法通过编译
不知道是什么原因
请高手指教

xrzmjz 发表于 2010-7-6 12:01:25

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
Dim $const=1

While $const=1
HotKeySet("F10","password")
        Func password()
               
                $Form1 = GUICreate("请输入密码",175, 2,$WS_CHILD)
                $Input1 = GUICtrlCreateInput("", 8, 8)
                GUISetState(@SW_SHOW)
               
                While 1
                        $nMsg = GUIGetMsg()
                       
                        Switch $nMsg
                                Case $GUI_EVENT_CLOSE
                                        Exit
                        EndSwitch
                       
                WEnd
               
        EndFunc
WEnd

xrzmjz 发表于 2010-7-6 12:01:51

两段代码均无法通过编译

南一 发表于 2010-7-6 12:02:55


#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
Dim $const = 1

While $const = 1
        HotKeySet("F10", "password")
        password()
WEnd

Func password()

        $Form1 = GUICreate("请输入密码", 175, 2)
        $Input1 = GUICtrlCreateInput("", 8, 8)
        GUISetState(@SW_SHOW)

        While 1
                $nMsg = GUIGetMsg()

                Switch $nMsg
                        Case $GUI_EVENT_CLOSE
                                Exit
                EndSwitch

        WEnd

EndFunc   ;==>password

辣椒龙 发表于 2010-7-6 12:38:45

楼上正解
While里不能 定义Func

lchl0588 发表于 2010-7-6 13:04:08

回复 6# 南一
哇,你啥时候回来啦!!!!!


不过偶测试楼主的原代码,结果如下图:

xsjtxy 发表于 2010-7-6 13:15:47

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

HotKeySet("{F10}","password")

While 1

sleep(10)

WEnd


      Func password()
        HotKeySet("{F10}","password2")
                $Form1 = GUICreate("请输入密码",214, 40)
                $Input1 = GUICtrlCreateInput("", 8, 8)
                GUISetState(@SW_SHOW)
               
                While 1
                        $nMsg = GUIGetMsg()
                        
                        Switch $nMsg
                              Case $GUI_EVENT_CLOSE
                                        Exit
                        EndSwitch
                WEnd
      EndFunc
      Func password2()
      EndFunc

3mile 发表于 2010-7-6 13:49:08

HotKeySet("{F10}","password")

While 1
        sleep(10)
WEnd


Func password()
    $Input1 = InputBox("安全性检查", "输入你的密码.", "", "*")
        If $input1=="abcdefg" Then
                MsgBox(0,0,"此处执行你的代码")
                Exit
        Else
                MsgBox(0,0,"密码错,重新输入")
                password()
        EndIf
EndFunc

rikthhpgf2005 发表于 2010-7-6 16:34:15

10楼的才可以,两个while放一起,,!!!!!!!{:face (382):}

南一 发表于 2010-7-6 17:12:55

回复 8# lchl0588

我有时候会来下,但基本山不回帖,惜字如金啊。

jonyzhr 发表于 2010-7-7 09:04:23

学习学习了,

kemyliu 发表于 2010-7-7 09:25:16

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
Dim $const=1
HotKeySet("{F10}","password")
While $const=1
        Sleep(100)
WEnd
Func password()
        $Form1 = GUICreate("请输入密码",200, 50,-1,-1)
        $Input1 = GUICtrlCreateInput("", 8, 8,175,20)
        GUISetState(@SW_SHOW)
        While 1
                $nMsg = GUIGetMsg()
                Switch $nMsg
                        Case $GUI_EVENT_CLOSE
                                Exit
                EndSwitch
        WEnd            
EndFunc

chenronting 发表于 2010-7-7 10:06:52

都写的差不多了。就说下我的看法吧
就是 func 不管在哪里都好。就是不能放到循环里。
他只要一个调用就行了。你放进去 没用。还显的乱了。
他们是独立的小结构,OVEr
页: [1]
查看完整版本: 奇怪的错误,请高人帮忙调试