#include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <Array.au3> #include <GuiListView.au3> #Include <File.au3> $GUI = GUICreate("Тест", 350, 200) Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, "quit") $hListView= GUICtrlCreateListView ("col1 ",10,10,200,150) $hLable=GUICtrlCreateLabel ("Lable", 230,25,50,20) For $i = 0 To 3 _GUICtrlListView_AddItem ($hListView, 'C:') Next GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() While 1 Sleep(200) WEnd ;========================================================================= Func __ArrayDisplay($ar,$name='',$time=0) ;========================================================================= ; Имя функции : Отображение одномерного массива в окне консоли ; Синтаксис : __ArrayDisplay(Имя архива,'Имя архива'[,Время отображения в MsgBox]) ;========================================================================= Local $txt For $i =0 To UBound($ar)-1 $txt&=StringFormat ("%-2d " & "%-s\n" ,$i, $ar[$i]) Next ConsoleWrite('========================' & @CRLF &"Array : " &$name & @CRLF & '========================'& @CRLF) ConsoleWrite($txt) MsgBox(0,'Массив : '&$name,$txt,$time) Return $txt EndFunc ;=========> __ArrayDisplay ;=================================================== Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) ;================================================================== #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $iCode Case $NM_CLICK ; Одинарный клик левой кнопкой мыши Local $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $aHit = _GuiCtrlListView_SubItemHitTest ($hWndFrom) Click($hWndFrom,$aHit[0]) ; =====> EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func Click($hWnd,$item) $itemTxt=_GUICtrlListView_GetItemText($hWnd, $item ) GUICtrlSetData( $hLable,$itemTxt) $txt=GUICtrlRead ( $hLable ,1 ) $FileList=_FileListToArray($txt & '\Program Files','*',0) __ArrayDisplay($FileList,'$FileList') ;- _ArrayDisplay($FileList,'$FileList') ; не работает EndFunc Func quit() Exit EndFunc ; ====> quit |