dakai 发表于 2009-6-26 16:10:10

这样写为什么出错?

如下这样,出错为什么
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("父窗口", 381, 205, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 128, 56, 105, 65, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg(1)
        Select
                Case $nMsg(0)=$Button1
                        $Form2 = GUICreate("子窗口", 381, 205, 192, 124)
                        $Button2 = GUICtrlCreateButton("Button2", 128, 56, 105, 65, $WS_GROUP)
                        GUISetState(@SW_SHOW)
                Case $nMsg(0)=$GUI_EVENT_CLOSE
                        If $nMsg(1)=$Form2 Then
                                GUIDelete()
                        ElseIf $nMsg(1)=$Form1 Then
                                GUIDelete()
                                Exit
                        EndIf
        EndSelect
WEnd

hhasee 发表于 2009-6-26 16:45:54

While 1
      $nMsg = GUIGetMsg()
      Select
                Case $Button1
                        $Form2 = GUICreate("子窗口", 381, 205, 192, 124)
                        $Button2 = GUICtrlCreateButton("Button2", 128, 56, 105, 65, $WS_GROUP)
                        GUISetState(@SW_SHOW)
                Case $GUI_EVENT_CLOSE
                        If $nMsg(1)=$Form2 Then
                              GUIDelete()
                        ElseIf $nMsg(1)=$Form1 Then
                              GUIDelete()
                              Exit
                        EndIf
      EndSelect
WEnd
虽解决了报错的问题,但此为一个死循环,不知楼主到底要做什么?
页: [1]
查看完整版本: 这样写为什么出错?