找回密码
 加入
搜索
查看: 1866|回复: 6

listview的问题

[复制链接]
发表于 2009-9-21 20:41:45 | 显示全部楼层 |阅读模式
Func file()
        $seach = FileFindFirstFile("c:\windows\*.exe")
        If $seach = -1 Then
                MsgBox(1,"title","无法打开文件")
                Exit
        EndIf
        While 1
                $file = FileFindNextFile($seach)
                $filesize = FileGetSize($file)
                $list = $file & "|" & $filesize
                If @error = -1 Then ExitLoop
                $sr = GUICtrlCreateListViewItem($list,$listview)
        WEnd
EndFunc

这段程序写入listview以后。怎么还写入了很多空值。怎么解决呢。请大家跟我说一说。谢谢。

本帖子中包含更多资源

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

×
发表于 2009-9-21 20:45:48 | 显示全部楼层
FileGetSize 里面的路径不是完整路径
发表于 2009-9-21 20:53:08 | 显示全部楼层
本帖最后由 afan 于 2009-9-21 23:05 编辑

这样改下吧~
$filesize = FileGetSize(@WindowsDir & '\' & $file)
 楼主| 发表于 2009-9-21 21:01:35 | 显示全部楼层
不可否认,这样确实可以把.exe的文件大小都显示出来。但是还是有空值的出现。
发表于 2009-9-21 21:03:01 | 显示全部楼层
那你就自己弄吧
发表于 2009-9-21 22:27:48 | 显示全部楼层
唉,人家给的思路都这样了还不能引玉?
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 620, 447, 192, 124)
$listview=GUICtrlCreateListView("文件名|大小(Kbyte)",10,10,600,400)

GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
file()
While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd
Func file()
        $seach = FileFindFirstFile(@WindowsDir&'\*.exe')
        If $seach = -1 Then
                MsgBox(1, "title", "无法打开文件")
                Exit
        EndIf
        While 1
                $file = FileFindNextFile($seach)
                                If @error  Then ExitLoop
                $filesize = int(FileGetSize(@WindowsDir&'\' & $file)/1024*1000)/1000 
                $list = $file & "|" & $filesize
                $sr = GUICtrlCreateListViewItem($list, $listview)
        WEnd
EndFunc   ;==>file
发表于 2010-4-11 21:49:35 | 显示全部楼层
好好。。。。。。。学习。。。。。。。。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-22 09:58 , Processed in 0.122273 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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