找回密码
 加入
搜索
查看: 1456|回复: 3

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

[复制链接]
发表于 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




[ 本帖最后由 Cisoce 于 2009-2-8 06:18 编辑 ]
发表于 2009-2-8 07:57:44 | 显示全部楼层
$form2 = GUICreate("关于程序", 293, 127, 300, 200)

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

[ 本帖最后由 cnsnc 于 2009-2-8 07:59 编辑 ]
发表于 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 编辑 ]
 楼主| 发表于 2009-2-8 18:30:38 | 显示全部楼层
谢谢楼上两位兄弟,还有一个问题就是我调用vista主题,主窗口背景是白色的,但是弹出的第二个窗口背景色却是灰色的 这是为什么呢,如何让第二个窗口背景也是白色?
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-23 20:18 , Processed in 0.076042 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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