找回密码
 加入
搜索
查看: 4249|回复: 4

[GUI管理] [已解决]如何设置 GUICtrlCreateListView 第一列的宽度?

[复制链接]
发表于 2014-10-21 11:09:32 | 显示全部楼层 |阅读模式
本帖最后由 chishingchan 于 2014-10-21 17:29 编辑

此程序的作用是对比安装版软件的文件与达人发布的程序压缩包对比文件的不同。
我的原意是名称占用左侧大部分空间,大小及CRC32靠窗口右侧,请问如何处理?
名称大小CRC32.au3
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Local $sDir = FileSelectFolder("选择一个文件夹.", "")

GUICreate($sDir,640,480,100,200,-1,$WS_EX_ACCEPTFILES)
$listview = GUICtrlCreateListView("名称|大小|CRC32",0,0,640,480)

FindAllFile($sDir)

Func FindAllFile($sDir)
            Local $hSearch = FileFindFirstFile($sDir & "\*.*")
    If $hSearch = -1 Then Return
    While 1
        Local $sFile = FileFindNextFile($hSearch)
        If @error Then ExitLoop
        If @extended Then 
            FindAllFile($sDir & "" & $sFile)
            ContinueLoop
        EndIf
                $BufferSize = 0x20000
                Global $sCRC32 = 0
                For $i = 1 To Ceiling(FileGetSize($sDir & "" & $sFile)/$BufferSize)
                        $sCRC32 = _CRC32(FileRead(FileOpen($sDir & "" & $sFile,16),$BufferSize),BitNot($sCRC32))
                Next
                GUICtrlCreateListViewItem($sDir & "" & $sFile & "|" & FileGetSize($sDir & "" & $sFile) & "|" & Hex($sCRC32,8), $listview)
    WEnd
    FileClose($hSearch)
EndFunc

GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUISetState()

Do
        $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

Func _CRC32($Data, $CRC32 = -1)
        Local $Opcode = '0xC800040053BA2083B8EDB9000100008D41FF516A0859D1E8730231D0E2F85989848DFCFBFFFFE2E78B5D088B4D0C8B451085DB7416E3148A1330C20FB6D2C1E80833849500FCFFFF43E2ECF7D05BC9C21000'
        Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]")
        DllStructSetData($CodeBuffer, 1, $Opcode)
        Local $Input = DllStructCreate("byte[" & BinaryLen($Data) & "]")
        DllStructSetData($Input, 1, $Data)
        Local $Ret = DllCall("user32.dll", "uint", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), _
                                                                                                        "ptr", DllStructGetPtr($Input), _
                                                                                                        "int", BinaryLen($Data), _
                                                                                                        "uint", $CRC32, _
                                                                                                        "int", 0)
        $Input = 0
        $CodeBuffer = 0
        Return $Ret[0]
EndFunc
发表于 2014-10-21 13:09:46 | 显示全部楼层
$hListview = controlgethandle($listview)
_GUICtrlListView_SetColumnWidth($hListview , $iCol, $iWidth)
发表于 2014-10-21 13:51:44 | 显示全部楼层
路过留名,感谢分享
 楼主| 发表于 2014-10-21 17:28:31 | 显示全部楼层
$hListview = controlgethandle($listview)
_GUICtrlListView_SetColumnWidth($hListview , $iCol, $iWidt ...
netegg 发表于 2014-10-21 13:09


谢谢!可以了!只是这一行少了两个参数。
    $hListview = controlgethandle($listview)
发表于 2015-1-30 00:03:07 | 显示全部楼层
正好需要~~~学习中
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-18 12:13 , Processed in 0.074575 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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