Cisoce 发表于 2009-2-8 06:16:52

大家帮忙看看这段代码有什么错误

大家帮忙看看这段代码有什么错误,为什么我点击“关于程序”按钮程序会自动退出而不是显示新的窗口呢?以前好像不这样的请指教谢谢~

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("系统优化", 450, 350,192,114)

_SkinGUI("SkinCrafterDll.dll", "Vista.skf", $Form1)

Func _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle)
       
$Dll = DllOpen($SkincrafterDll)
   DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
   DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
   DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", $SkincrafterSkin)
   DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Handle, "int", 25)
   DllCall($Dll, "int:cdecl", "ApplySkin")
EndFunc

$Button2 = GUICtrlCreateButton("关于程序>", 30,290 , 80, 25, 0)

GUISetState(@SW_SHOW, $Form1)

While 1
$nmsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
                        Exit

Case $nMsg = $Button2
                Form2()        

EndSelect
       
WEnd



$form2 = GUICreate("关于程序", 293, 127, 300, 200)

GUISetState(@SW_HIDE )

Func Form2()
GUISetState(@SW_SHOW, $form2)
Endfunc


:face (30): :face (30):

[ 本帖最后由 Cisoce 于 2009-2-8 06:18 编辑 ]

cnsnc 发表于 2009-2-8 07:57:44

$form2 = GUICreate("关于程序", 293, 127, 300, 200)

GUISetState(@SW_HIDE )
这两行写到 WHILE1 的上面去或者写到 FORM2()的里面,“GUISetState(@SW_HIDE )”
去掉

[ 本帖最后由 cnsnc 于 2009-2-8 07:59 编辑 ]

lcgkogoo 发表于 2009-2-8 08:19:22

个人比较菜...这样也行..
可以返回..

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("系统优化", 450, 350,192,114)

_SkinGUI("SkinCrafterDll.dll", "Vista.skf", $Form1)

Func _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle)
      
$Dll = DllOpen($SkincrafterDll)
   DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "1", "wstr", "", "wstr", "1@1.com", "wstr", "1")
   DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
   DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", $SkincrafterSkin)
   DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Handle, "int", 25)
   DllCall($Dll, "int:cdecl", "ApplySkin")
EndFunc

$Button2 = GUICtrlCreateButton("关于程序>", 30,290 , 80, 25, 0)
$form2 = GUICreate("关于程序", 293, 127, 300, 200)
$Button3 = GUICtrlCreateButton("返回程序", 32, 32, 89, 33, 0)
$Button4 = GUICtrlCreateButton("退出程序", 160, 32, 89, 33, 0)

GUISetState(@SW_SHOW, $Form1)

While 1
$nmsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
                        Exit

Case $nMsg = $Button2
                Form2()         

EndSelect
      
WEnd


Func Form2()
GUISetState(@SW_HIDE )
GUISetState(@SW_SHOW, $form2)
While 1
$nmsg = GUIGetMsg()
Select
        Case $nMsg = $GUI_EVENT_CLOSE
          Exit
        Case $nMsg = $Button3
      GUISetState(@SW_HIDE )
      GUISetState(@SW_SHOW, $form1)
                ExitLoop
                Sleep(100)
       case $nMsg = $Button4
               go()               
EndSelect
WEnd
Endfunc

Func go()
        Exit
EndFunc

[ 本帖最后由 lcgkogoo 于 2009-2-8 08:33 编辑 ]

Cisoce 发表于 2009-2-8 18:30:38

谢谢楼上两位兄弟,还有一个问题就是我调用vista主题,主窗口背景是白色的,但是弹出的第二个窗口背景色却是灰色的 这是为什么呢,如何让第二个窗口背景也是白色?
页: [1]
查看完整版本: 大家帮忙看看这段代码有什么错误