找回密码
 加入
搜索
查看: 4230|回复: 10

[GUI管理] 页面切换控件释放的问题[已解决]

  [复制链接]
发表于 2011-1-29 17:22:49 | 显示全部楼层 |阅读模式
本帖最后由 872777825 于 2011-1-30 14:27 编辑

小弟弄了个小工具  共有几个切换页面

不知道哪里的问题  当选择GUICtrlCreateRadio 这类控件取消执行后

再点开其他页面时  那个选择过的控件画面就会显示在下个页面的(如图)



以为是内存问题
在官网这找了
;对脚本内存进行释放
Func _EmptyScriptMem()
                MsgBox(0,"2","234")
        ;~ 无论您是使用或者转载,请保留原作者(kn007)信息,谢谢!
        Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, _
        'int', False, 'int', @AutoItPID)
        Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
        DllCall("kernel32.dll" , 'int', 'CloseHandle', 'int', $ai_Handle[0])
EndFunc
这代码放在该控件取消安装后运行
也不能解决这个问题

没办法只要来请教各位老师

希望清楚的老师麻烦指点下  谢谢

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2011-1-29 17:29:39 | 显示全部楼层
这好似无关内存释放
是不是创建时归类有问题
发表于 2011-1-29 17:32:16 | 显示全部楼层
创建重复
先用 GUICtrlDelete()  删除后
再建
 楼主| 发表于 2011-1-29 17:41:10 | 显示全部楼层
回复 3# _ddqs.


    不是很明白老师的问题
能说明白点么
发表于 2011-1-29 17:49:56 | 显示全部楼层
是你的问题没有例子,不好明白.下面这个简单的例子没有问题,你写一个有问题的简单代码贴来看看.
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $tab, $tab0, $tab1, $tab2, $msg
        Local $radio01, $radio02, $radio11, $radio12
   
    GUICreate("My GUI Tab")  ; will create a dialog box that when displayed is centered

    GUISetBkColor(0x00E0FFFF)
    GUISetFont(9, 300)

    $tab = GUICtrlCreateTab(10, 10, 200, 100)

    $tab0 = GUICtrlCreateTabItem("tab0")
        $radio01 = GUICtrlCreateRadio("01", 20, 40)
        $radio02 = GUICtrlCreateRadio("02", 20,70)

    $tab1 = GUICtrlCreateTabItem("tab----1")
        $radio11 = GUICtrlCreateRadio("11", 20, 40)
        $radio12 = GUICtrlCreateRadio("12", 20,70)

    GUICtrlCreateTabItem("")    ; end tabitem definition

    GUISetState()

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
EndFunc   ;==>Example
 楼主| 发表于 2011-1-29 18:02:29 | 显示全部楼层
本帖最后由 872777825 于 2011-1-29 18:05 编辑

回复 5# smartzbs
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 623, 449, 192, 114)
$Radio1 = GUICtrlCreateRadio("Radio1", 120, 56, 121, 17)
$Radio2 = GUICtrlCreateRadio("Radio2", 120, 104, 97, 17)
$Radio3 = GUICtrlCreateRadio("Radio3", 120, 144, 97, 33)
$Button1 = GUICtrlCreateButton("Button1", 112, 288, 105, 25)
$Button2 = GUICtrlCreateButton("Button2", 256, 280, 105, 33)


$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 128, 40, 161, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 120, 80, 169, 25)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 120, 128, 177, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 120, 168, 137, 25)
$Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 120, 208, 137, 25)

GUICtrlSetState($Checkbox1, $gui_hide)
GUICtrlSetState($Checkbox2, $gui_hide)
GUICtrlSetState($Checkbox3, $gui_hide)
GUICtrlSetState($Checkbox4, $gui_hide)
GUICtrlSetState($Checkbox5, $gui_hide)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
                Case $Button1
                        GUICtrlSetState($Checkbox1, $gui_hide)
            GUICtrlSetState($Checkbox2, $gui_hide)
            GUICtrlSetState($Checkbox3, $gui_hide)
                        GUICtrlSetState($Checkbox4, $gui_hide)
            GUICtrlSetState($Checkbox5, $gui_hide)
                        GUICtrlSetState($Radio1, $gui_show)
                        GUICtrlSetState($Radio2, $gui_show)
                        GUICtrlSetState($Radio3, $gui_show)
                Case $Button2
                        GUICtrlSetState($Checkbox1, $gui_show)
                        GUICtrlSetState($Checkbox2, $gui_show)
                        GUICtrlSetState($Checkbox3, $gui_show)
            GUICtrlSetState($Checkbox4, $gui_show)
            GUICtrlSetState($Checkbox5, $gui_show)
                        GUICtrlSetState($Radio1, $gui_hide)
                        GUICtrlSetState($Radio2, $gui_hide)
                        GUICtrlSetState($Radio3, $gui_hide)
                Case $Radio1
                        $Radio1 = MsgBox(4 + 64, "tetst", "test?")
                        If $Radio1 = 6 Then
                                _Radio1()
                        Else
                        EndIf
        EndSwitch
WEnd

Func _Radio1()
        Exit
EndFunc
问题就是只要的了   麻烦老师看看    选择$Radio1  然后点否  再点$button2  就出问题了
 楼主| 发表于 2011-1-29 18:07:46 | 显示全部楼层
但如果选择$Radio2 $Radio3 这两个没命令的   它就不会跑到下一页   很怪异
发表于 2011-1-29 18:14:22 | 显示全部楼层
变量$Radio1重复使用了,将:
                        $Radio1 = MsgBox(4 + 64, "tetst", "test?")

                        If $Radio1 = 6 Then

                                _Radio1()

                        Else

                        EndIf

改为:

                        If  MsgBox(4 + 64, "tetst", "test?")=6 Then
                                _Radio1()
                        Else

                        EndIf

象这种页面最好使用我前面写的例子来做.
发表于 2011-1-29 18:24:20 | 显示全部楼层
重付值^……句柄丢失~!
                Case $Radio1
                        $Radio1s = MsgBox(4 + 64, "tetst", "test?")
                        If $Radio1s = 6 Then
                                _Radio1()
                        Else

                        EndIf
发表于 2011-1-30 12:55:19 | 显示全部楼层
 楼主| 发表于 2011-1-30 14:26:53 | 显示全部楼层
问题解决了  谢谢 smartzbs 和_ddqs. 老师  谢谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-3 02:46 , Processed in 0.085653 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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