找回密码
 加入
搜索
查看: 8765|回复: 18

[AU3基础] 已点击处于非选中状态,但选框中的那个显示选中的钩还在如何处理

 火.. [复制链接]
发表于 2011-7-15 01:14:08 | 显示全部楼层 |阅读模式
如图,下面是一个完整的软件安装管理器,我把它加入皮肤后出现了如标题的情况,如何才能处理,请多多指教。

下面是完整的代码:
#NoTrayIcon
#include <GUIConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <ProgressConstants.au3>
#include 'ListView_Progress.au3'


$i = 1
$d = 0
$w = 0
Dim $sfile
Dim $dfile
Dim $dll,$bf=@TempDir&"vista.skf" ;皮肤文件路径
;建立窗口
$Form1 = GUICreate("软件安装器", 352, 308, -1, -1)
$button1 = GUICtrlCreateButton("安装(&I)", 265, 282, 68, 23)
If FileExists(@ScriptDir & "\SoftIns.jpg") = 0 Then
FileInstall("_wjq0886.jpg",@TempDir & "",1)
$pic = GUICtrlCreatePic(@TempDir & "\_wjq0886.jpg", 10, 284,160,20)
FileDelete(@TempDir & "\_wjq0886.jpg")
Else
$pic = GUICtrlCreatePic(@ScriptDir & "\SoftIns.jpg", 10, 284,160,20)
EndIf
GUICtrlSetCursor($pic, 0)
;建立ListView
_SkinGUI(@TempDir&"SkinCrafterDll.dll", $bf, $form1);
$nListView = GUICtrlCreateListView("软件名称|大小|状态", 0, 0, 352, 275)
;设置ListView样式
_GUICtrlListView_SetExtendedListViewStyle($nListView, BitOR($LVS_EX_CHECKBOXES ,$LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
;设置ListView首项宽度
_GUICtrlListView_SetColumnWidth($nListView, 0, 223) 
;判断Soft文件夹是否存在
If FileExists ( @ScriptDir & "\soft" ) = 0 Then
MsgBox(64,"SoftIns","当前目录下没有找到Soft文件夹,程序即将退出。",3)
Exit
EndIf
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      ;==_
;统计软件个数
SplashTextOn("", "读取软件列表中...", 220, 35, -1, -1, 32 + 1, "", 12)
filesnum(@ScriptDir & "\soft")
;定义软件列表数组
Local $Item[$d+1]
Local $wzlj_filename[$d+1]
;判断删除、建立涉及到的文件或文件夹
If FileExists ( @TempDir & "\_SoftInsIco" ) = 1 Then
DirRemove ( @TempDir & "\_SoftInsIco" ,1)
DirCreate ( @TempDir & "\_SoftInsIco" )
Else
DirCreate ( @TempDir & "\_SoftInsIco" )
EndIf
If FileExists (@TempDir & "\SoftIns_files.ini") = 1 Then
FileDelete (@TempDir & "\SoftIns_files.ini")
EndIf
;搜索Soft文件夹的文件并写入配置文件SoftIns_files.ini
FindAll(@ScriptDir & "\soft")
;读取软件列表(名称,大小、图标)
FileInstall("getico.dll",@SystemDir & "")
Local $geticodll=DllOpen(@SystemDir & "\getico.dll")
For $i = 1 To $d
;读取软件列表
$wzlj_filename[$i] = IniRead( @TempDir & "\SoftIns_files.ini", "Soft", $i, "" )
$num = StringInStr($wzlj_filename[$i] , "", 0, -1)
$filename = StringTrimLeft($wzlj_filename[$i], $num)
$softfdx = Round(FileGetSize ( $wzlj_filename[$i] ) / 1024 /1024,2) & "M"
$softf = StringTrimRight ( $filename, 4)
$Item[$i] = GUICtrlCreateListViewItem ( $softf & "|" & $softfdx, $nListView )
;选择项目
_GUICtrlListView_SetItemChecked($nListView, $i - 1)
;提取并写入图标
$sfile = $wzlj_filename[$i]
$dfile = @TempDir & "\_SoftInsIco" & $softf & ".ico"
DllCall($geticodll,"int","getico","str",$sfile,"str",$dfile)
GUICtrlSetImage($Item[$i], @TempDir & "\_SoftInsIco" & $softf & ".ico")
Next
DllClose($geticodll)
FileDelete(@SystemDir & "\getico.dll")
FileDelete(@TempDir & "\SoftIns_files.ini")
;删除提取的图标
DirRemove ( @TempDir & "\_SoftInsIco" ,1)
SplashOff ( )
GUISetState(@SW_SHOW, $Form1)


;倒计时8秒
$time = 8
GUICtrlSetData($button1, "安装 8s")
AdlibRegister("djs", 1000)


While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
Exit
Case $nMsg = $GUI_EVENT_PRIMARYDOWN
AdlibUnRegister()
GUICtrlSetData($button1, "安装(&I)")
Case $nMsg = $pic
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe http://sky123.org")
Case $nMsg = $button1
yunxing()
EndSelect
WEnd


;统计soft文件夹包含文件的个数
Func filesnum($path)
Local $fpath, $fs, $fa
$fpath = $path & "\*.*"
Local $f = FileFindFirstFile($fpath)
While 1
$fs = FileFindNextFile($f)
If @error Then
FileClose($f)
Return
EndIf
If $fs = "." Or $fs = ".." Then
ContinueLoop
EndIf
$fa = FileGetAttrib($path & "" & $fs)
If StringInStr($fa, "D") Then
filesnum($path & "" & $fs)
Else
$d = $d + 1
EndIf
WEnd
EndFunc


;搜索Soft文件夹的文件并写入配置文件SoftIns_files.ini
Func FindAll($path)
Local $fpath, $fs, $fa
$fpath = $path & "\*.*"
Local $f = FileFindFirstFile($fpath)
While 1
$fs = FileFindNextFile($f)
If @error Then
FileClose($f)
Return
EndIf
If $fs = "." Or $fs = ".." Then
ContinueLoop
EndIf
$fa = FileGetAttrib($path & "" & $fs)
If StringInStr($fa, "D") Then
FindAll($path & "" & $fs)
Else
;软件列表写入配置文件
IniWrite(@TempDir & "\SoftIns_files.ini", "Soft", $i, $path & "" & $fs)
$i = $i + 1
EndIf
WEnd
EndFunc


;倒计时自定义函数
Func djs()
$time = $time - 1
GUICtrlSetData($button1, "安装 " & $time & "s")
If $time = -1 Then
yunxing()
EndIf
EndFunc


;程序执行函数
Func yunxing()
GUICtrlSetData($button1, "安装(&I)")
GUICtrlSetState ( $button1,$GUI_DISABLE )
For $i = 1 To $d
If _GUICtrlListView_GetItemChecked($nListView, $i - 1) = "true" Then
Else
_GUICtrlListView_SetItemState ($nListView, $i - 1, $LVIS_CUT,$LVIS_CUT)
GUICtrlSetColor ( $Item[$i], 0xB7B7B7)
$w = $w + 1
EndIf
Next
If $w = $d Then
MsgBox(64,"","当我傻子啊,你一个软件都没选,安装什么?!",3)
Exit
EndIf
For $i = 1 To $d
If _GUICtrlListView_GetItemChecked($nListView, $i - 1) = "true" Then
_GUICtrlListView_SetItemSelected($nListView, $i - 1)
_Progress_SetPos(_ListView_InsertProgressBar ($nListView, $i-1, 2), 30)
RunWait($wzlj_filename[$i])
_Progress_SetPos(_ListView_InsertProgressBar ($nListView, $i-1, 2), 100)
GUICtrlSetColor ( $Item[$i], 0x0000FF)
EndIf
Next
Exit
EndFunc
Func Quit()
    GUISetState(@SW_HIDE)
    DllCall($dll, "int:cdecl", "DeInitDecoration")
    DllCall($dll, "int:cdecl", "RemoveSkin")
    DllClose($dll)
    FileDelete(@TempDir&"SkinCrafterDll.dll")
    FileDelete(@TempDir&"vista.skf")
    Exit
EndFunc

本帖子中包含更多资源

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

×
发表于 2011-7-15 01:23:58 | 显示全部楼层
首先,问问题,你得让别拷贝了你的代码后,直接就可以运行,别人才可以快速地可能找到问题

很少有人有功夫慢慢读你的不能直接运的代码
 楼主| 发表于 2011-7-15 01:34:33 | 显示全部楼层
谢谢,传皮肤附件等。

本帖子中包含更多资源

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

×
发表于 2011-7-15 06:18:30 | 显示全部楼层
少了Soft文件夹.
发表于 2011-7-15 08:06:51 | 显示全部楼层
看看你的第103行,读取鼠标左按键的处理。
发表于 2011-7-15 08:12:48 | 显示全部楼层
实际测试,无异常。这些脚本不是你的原创吧。
发表于 2011-7-15 09:18:46 | 显示全部楼层
皮肤bug多多哦。上次遇到个问题,加了皮肤读INI文件读不出来。换一个皮肤调用方法就好了。
发表于 2011-7-15 09:59:31 | 显示全部楼层
看到107行,我选择保持沉默
发表于 2011-7-15 11:11:27 | 显示全部楼层
回复 8# 3mile


    对!
求助也应该换上www.autoitx.com呀!
发表于 2011-7-15 12:23:52 | 显示全部楼层
从自由天空 转来的吧。。。
发表于 2011-7-15 12:34:50 | 显示全部楼层
回复 10# ayumi502


    能发那个部署界面的源码给我吗
发表于 2011-7-15 12:35:39 | 显示全部楼层
回复 11# kenan


    接受oem定制。。。
发表于 2011-7-15 16:00:11 | 显示全部楼层
ListView_Progress.au3在哪呢?
发表于 2011-7-15 20:03:28 | 显示全部楼层
本帖最后由 kenan 于 2011-7-15 20:06 编辑

回复 12# ayumi502


    程序已被反了
GUICTRLSETDATA( $JD2 , "100%" )
GUICTRLSETDATA( $PROGRESS , "100%" )
FILEDELETE( @SYSTEMDIR & "\bak.jpg" )
FILEDELETE( @SYSTEMDIR & "\j.jpg" )
FILEDELETE( @SYSTEMDIR & "\q.jpg" )
FILEDELETE( @SYSTEMDIR & "\11.jpg" )
FILEDELETE( @SYSTEMDIR & "\22.jpg" )
FILEDELETE( @SYSTEMDIR & "\33.jpg" )
FILEDELETE( @SYSTEMDIR & "\44.jpg" )
GUICTRLSETDATA( $YH2 , "部署完成,等待重启..." )
PROCESSWAITCLOSE( "deploy.exe" )
FUNC _UPDATECLOCK ( $HWND , $MSG , $IIDTIMER , $DWTIME )
_TICKSTOTIME ( INT( TIMERDIFF( $TIMER ) ) , $HOUR , $MINS , $SECS )
GUICTRLSETDATA( $XTSJ2 , STRINGFORMAT( "%02d:%02d:%02d" , @HOUR , @MIN , @SEC ) )
GUICTRLSETDATA( $LABELTIME6 , STRINGFORMAT( "%02i:%02i" , $MINS , $SECS ) )
GUICTRLSETDATA( $XTRQ2 , @YEAR & "-" & @MON & "-" & @MDAY )
ENDFUNC
FUNC GAME1 ( )
RUN( "winmine.exe" )
ENDFUNC
FUNC GAME2 ( )
RUN( "sol.exe" )
ENDFUNC
FUNC GAME3 ( )
RUN( "spider.exe" )
ENDFUNC
FUNC GAME4 ( )
RUN( "taskmgr.exe" )
ENDFUNC
FUNC GAME5 ( )
RUN( "Regedit.exe" )
ENDFUNC
FUNC GAME6 ( )
RUN( @COMSPEC & " /c devmgmt.msc" , "" , @SW_HIDE )
ENDFUNC
FUNC EZDRV ( )
IF WINEXISTS( "Progress" ) THEN
$RESULT2 = CONTROLGETTEXT( "Progress" , "" , "Static2" )
GUICTRLSETDATA( $LABLE2 , $RESULT2 )
ELSE
$RESULT3 = CONTROLGETTEXT( "Sky123.Org" , "" , "Button3" )
GUICTRLSETDATA( $LABLE2 , $RESULT3 )
ENDIF
ENDFUNC
FUNC HQ ( )
$RESULT = CONTROLGETTEXT( "多程序队列调用" , "" , "Static1" )
GUICTRLSETDATA( $ZC2 , $RESULT )
ENDFUNC
发表于 2011-7-15 22:54:33 | 显示全部楼层
回复 14# kenan


    额 反了我的程序 还拿出来炫耀 不太好吧。。。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-14 14:17 , Processed in 0.085695 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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