Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_Outfile=File_manager.exe
- #AutoIt3Wrapper_Icon=File_manager.ico
- #AutoIt3Wrapper_Compression=4
- #AutoIt3Wrapper_Res_Comment=-
- #AutoIt3Wrapper_Res_Description=File_manager.exe
- #AutoIt3Wrapper_Res_Fileversion=0.3.0.0
- #AutoIt3Wrapper_Res_FileVersion_AutoIncrement=n
- #AutoIt3Wrapper_Res_LegalCopyright=AZJIO
- #AutoIt3Wrapper_Res_Language=1049
- #AutoIt3Wrapper_Run_Au3check=n
- #AutoIt3Wrapper_Res_Field=Version|0.3
- #AutoIt3Wrapper_Res_Field=Build|2013.11.12
- #AutoIt3Wrapper_Res_Field=Coded by|AZJIO
- #AutoIt3Wrapper_Res_Field=Compile date|%longdate% %time%
- #AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer%
- #AutoIt3Wrapper_Run_Obfuscator=y
- #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
- #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_Obfuscated.au3"
- #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #include <GUIConstantsEx.au3>
- #include <GuiTreeView.au3>
- #include <WindowsConstants.au3>
- ; #include <GuiImageList.au3>
- #include <File.au3>
- #include <GuiListView.au3>
- #include <GuiStatusBar.au3>
- #include <FileOperations.au3>
- ; #Include <Array.au3> ; тест
- Opt("GUIOnEventMode", 1)
- Global $PathCur, $TrWM_NOTIFY = 0
- ; En
- $LngTitle = 'File manager'
- $LngJmp = 'Go'
- $LngTmAs = 'Access time :'
- $LngSec = 'sec'
- $LngBS = 'Up'
- ; $LngCpP = 'Copy path'
- ; $LngDel = 'Delete'
- $UserIntLang = @OSLang
- ; Ru
- ; если русская локализация, то русский язык
- If $UserIntLang = 0419 Then
- $LngTitle = 'Файловый менеджер'
- $LngJmp = 'Перейти'
- $LngTmAs = 'Время доступа :'
- $LngSec = 'сек'
- $LngBS = 'Вверх'
- ; $LngCpP = 'Копировать путь'
- ; $LngDel = 'Удалить'
- EndIf
- $hGui = GUICreate($LngTitle, 640, 560, -1, -1, $WS_OVERLAPPEDWINDOW)
- GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
- Local $aParts[3] = [640 - 210, -1]
- $hStatusBar = _GUICtrlStatusBar_Create($hGui, $aParts, '', $SBARS_TOOLTIPS + $SBARS_SIZEGRIP)
- $restart = GUICtrlCreateButton("R", 640 - 20, 2, 18, 20)
- GUICtrlSetResizing(-1, 512 + 256 + 32 + 4)
- GUICtrlSetOnEvent(-1, "_restart")
- $iBS = GUICtrlCreateButton("^", 5, 6, 24, 24)
- GUICtrlSetResizing(-1, 2 + 32 + 256 + 512)
- GUICtrlSetOnEvent(-1, "_ActionBS")
- GUICtrlSetTip(-1, $LngBS)
- $Address = GUICtrlCreateInput('', 32, 6, 540, 24)
- GUICtrlSetResizing(-1, 2 + 4 + 32 + 512)
- $go = GUICtrlCreateButton(">", 577, 6, 24, 24)
- GUICtrlSetResizing(-1, 4 + 32 + 256 + 512)
- GUICtrlSetOnEvent(-1, "_Jump")
- GUICtrlSetTip(-1, $LngJmp)
- $iTreeView = GUICtrlCreateTreeView(0, 35, 216, 500, -1, $WS_EX_CLIENTEDGE)
- GUICtrlSetResizing(-1, 2 + 32 + 64 + 256)
- $hTreeView = GUICtrlGetHandle($iTreeView)
- $hImage = _GUIImageList_Create(16, 16, 5, 1)
- _GUIImageList_AddIcon($hImage, @SystemDir & '\shell32.dll', -4)
- ; _GUIImageList_AddIcon($hImage, @SystemDir & '\shell32.dll', -5)
- ; _GUIImageList_AddIcon($hImage, @SystemDir & '\shell32.dll', 0)
- _GUICtrlTreeView_SetNormalImageList($hTreeView, $hImage)
- $DrivesArr = DriveGetDrive("all")
- For $i = 1 To $DrivesArr[0]
- If $DrivesArr[$i] = 'a:' Or DriveGetType($DrivesArr[$i] & '\') = 'CDROM' Then ContinueLoop
- $hTmp = _GUICtrlTreeView_Add($hTreeView, 0, StringUpper($DrivesArr[$i]), 0, 0)
- _GUICtrlTreeView_SetChildren($hTreeView, $hTmp) ; добавляем плюсик
- Next
- $iListView = GUICtrlCreateListView(' ', 220, 35, 420, 500, $LVS_NOCOLUMNHEADER + $LVS_SHOWSELALWAYS, BitOR($LVS_EX_INFOTIP, $WS_EX_CLIENTEDGE, $LVS_EX_FULLROWSELECT))
- ; GUICtrlSendMsg($iListView, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_TRACKSELECT, $LVS_EX_TRACKSELECT)
- GUICtrlSetBkColor(-1, 0xf0f0f0) ; 0xE0DFE3
- GUICtrlSetResizing(-1, 2 + 4 + 32 + 64)
- $hListView = GUICtrlGetHandle($iListView)
- _GUICtrlListView_SetColumnWidth($iListView, 0, 390)
- Local $g_aExtAssot[1] = [0] ; Белый список ассоциаций
- Local $g_aExtBlack[6] = [5, 'exe', 'scr', 'ico', 'ani', 'cur'] ; Чёрный список ассоциаций
- $g_hImgAssot = _GUIImageList_Create(16, 16, 5, 1)
- _GUICtrlListView_SetImageList($iListView, $g_hImgAssot, 1)
- ; _GUICtrlTreeView_SetNormalImageList($hTreeView, $g_hImgAssot)
- _GUIImageList_AddIcon($g_hImgAssot, @SystemDir & '\shell32.dll', -4)
- ; _GUIImageList_AddIcon($g_hImgAssot, @SystemDir & '\shell32.dll', -5)
- For $i = 1 To 10
- _GUIImageList_AddIcon($g_hImgAssot, @SystemDir & '\shell32.dll', 0) ; Делаем кэш 9 иконок для EXE-файлов. В папке первые 9 EXE-файлов будут отображаться своими иконками, а если более 9, то остальные будут пустышками отображаться. надеюсь 9 достаточно.
- Next
- $ReLbl = GUICtrlCreateLabel('', 216, 35, 5, 500)
- GUICtrlSetResizing(-1, 2 + 32 + 64 + 256)
- GUICtrlSetCursor(-1, 13)
- GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_ResizeField")
- $iDummyEnter = GUICtrlCreateDummy()
- GUICtrlSetOnEvent(-1, "_ActionEnter")
- Local $AccelKeys[1][2] = [["{Enter}", $iDummyEnter]] ; , ["{Backspace}", $iBS] ; Задейстование Backspace запрещает редактирование в адресной строке
- GUISetAccelerators($AccelKeys)
- ; GUICtrlSetOnEvent(-1, "_OpenExplorer")
- GUISetState()
- GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY')
- GUIRegisterMsg($WM_SIZE, "WM_SIZE")
- GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO")
- ; перейти к нужной папке
- ; $StartPath='C:\AutoIt3\Notepad++'
- ; GUICtrlSetData($Address, $StartPath)
- ; _Jump()
- While 1
- Sleep(100000)
- WEnd
- Func _Exit()
- Exit
- EndFunc ;==>_Exit
- Func _ActionBS()
- ; Switch ControlGetFocus($hGui)
- ; Case 'SysTreeView321', 'SysListView321', 'Button2'
- ; Local $tmp = StringRegExpReplace($PathCur, '(\\[^\\]+)$', '')
- ; If @extended Then _Jump1($tmp)
- ; EndSwitch
- ; Local $tmp = StringRegExpReplace($PathCur, '(\\[^\\]+)$', '')
- ; If @extended Then _Jump1($tmp)
- ; GUICtrlSetState($iTreeView, $GUI_FOCUS)
- ; ControlFocus($hGui, "", $iTreeView)
- $hItem = _GUICtrlTreeView_GetSelection($hTreeView) ; получает дескриптор
- $hItem = _GUICtrlTreeView_GetParentHandle($hTreeView, $hItem)
- If $hItem Then _GUICtrlTreeView_ClickItem($hTreeView, $hItem)
- EndFunc
- Func _ActionEnter()
- Switch ControlGetFocus($hGui)
- Case 'Edit1'
- _Jump()
- Case 'SysTreeView321'
- $hItem = _GUICtrlTreeView_GetSelection($hTreeView) ; получает дескриптор
- $sPath = _GetPathItem($hTreeView, $hItem) ; Получили текущий уже открытый
- _Jump1($sPath)
- Case 'SysListView321'
- _GUICtrlListView_ClickItem($hListView, _GUICtrlListView_GetSelectedIndices($hListView), "left", False, 2)
- GUICtrlSetState($iListView, $GUI_FOCUS)
- EndSwitch
- EndFunc ;==>_ActionEnter
- Func _Jump()
- Local $sKey = GUICtrlRead($Address)
- _Jump1($sKey)
- EndFunc ;==>_Jump
- Func _Jump1($sKey)
- Local $aKey, $hItem, $i, $j, $key, $KeyChild, $sKey2, $sPath, $aPath, $q = 1, $tmp
- If Not FileExists($sKey) Then Return
- $hItem = _GUICtrlTreeView_GetSelection($hTreeView) ; получает дескриптор
- $sPath = _GetPathItem($hTreeView, $hItem) ; Получили текущий уже открытый
- ; Проверить, является ли установочный путь частью уже открытого пути
- $aKey = StringSplit($sKey, '\')
- $sKey = $aKey[1]
- $sKey2 = $aKey[1]
- If $sPath Then
- $aPath = StringSplit($sPath, '\')
- If $aPath[0] < $aKey[0] Then ; Берётся минимальный размер массива, чтобы не было сбоя при попытке обратиться к меньшему массиву используя конечный индекс большего массива.
- $tmp = $aPath[0]
- Else
- $tmp = $aKey[0]
- EndIf
- ; Вычисление начала отсчёта
- For $i = 1 To $tmp
- If $aPath[$i] <> $aKey[$i] Then ExitLoop
- If $i = 1 Then ContinueLoop
- $q += 1
- $sKey &= '|' & $aKey[$i]
- $sKey2 &= '\' & $aKey[$i]
- Next
- EndIf
- ; MsgBox(0, $i, $sKey & @LF & $sKey2 & @LF & $q & @LF & $aKey[0])
- For $i = $q To $aKey[0]
- If $i > $q Then
- $sKey &= '|' & $aKey[$i]
- $sKey2 &= '\' & $aKey[$i]
- EndIf
- ControlTreeView($hGui, "", $hTreeView, "Select", $sKey) ; выделяет раздел
- If @error Then
- If $i = $q Then
- Return
- Else
- ExitLoop
- EndIf
- EndIf
- $hItem = _GUICtrlTreeView_GetSelection($hTreeView) ; получает дескриптор
- If _GUICtrlTreeView_GetChildren($hTreeView, $hItem) And Not _GUICtrlTreeView_ExpandedOnce($hTreeView, $hItem) Then
- $tmp = _FileListToArray($sKey2, "*", 2)
- If @error Then Return
- For $j = 1 To $tmp[0]
- $tmp1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem, $tmp[$j], 0, 0)
- $search = FileFindFirstFile($sKey2 & '\' & $tmp[$j] & '\*')
- If $search <> -1 Then
- While 1
- $file = FileFindNextFile($search)
- If @error Then ExitLoop
- If @extended Then
- _GUICtrlTreeView_SetChildren($hTreeView, $tmp1) ; добавляем плюсик
- ExitLoop
- EndIf
- WEnd
- EndIf
- $tmp1 = ''
- FileClose($search)
- Next
- EndIf
- _GUICtrlTreeView_Expand($hTreeView, $hItem) ; разворачивает пункт
- Next
- _GUICtrlTreeView_ClickItem($hTreeView, $hItem, "left", False)
- EndFunc ;==>_Jump1
- Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam)
- _GUICtrlStatusBar_Resize($hStatusBar)
- Local $aParts[3] = [BitAND($ilParam, 0xFFFF) - 210, -1]
- _GUICtrlStatusBar_SetParts($hStatusBar, $aParts)
- Return $GUI_RUNDEFMSG
- EndFunc ;==>WM_SIZE
- Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
- Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tmp, $TrWM_NOTIFY = 1
- $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
- $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
- $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
- $iCode = DllStructGetData($tNMHDR, "Code")
- Switch $hWndFrom
- Case $hTreeView
- Switch $iCode
- Case $NM_CLICK
- ; получение хэндла кликнутого пункта и поиск его в массиве
- Local $tMPos = _WinAPI_GetMousePos(True, $hWndFrom), $tHit = _GUICtrlTreeView_HitTestEx($hWndFrom, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
- Local $hItem = DllStructGetData($tHit, "Item")
- If $hItem > 0 Then
- $tmp = _GetPathItem($hWndFrom, $hItem)
- If $PathCur = $tmp Then
- Return
- Else
- $PathCur = $tmp
- EndIf
- GUICtrlSetData($Address, $PathCur)
- $timer = TimerInit()
- _ListView_Update()
- If _GUICtrlTreeView_GetChildren($hWndFrom, $hItem) And Not _GUICtrlTreeView_ExpandedOnce($hWndFrom, $hItem) Then
- $tmp = _FileListToArray($PathCur, "*", 2)
- If @error Then Return
- ; _GUICtrlTreeView_BeginUpdate($hWndFrom)
- For $i = 1 To $tmp[0]
- $tmp1 = _GUICtrlTreeView_AddChild($hTreeView, $hItem, $tmp[$i], 0, 0)
- $search = FileFindFirstFile($PathCur & '\' & $tmp[$i] & '\*')
- If $search <> -1 Then
- While 1
- $file = FileFindNextFile($search)
- If @error Then ExitLoop
- If @extended Then
- _GUICtrlTreeView_SetChildren($hWndFrom, $tmp1) ; добавляем плюсик
- ExitLoop
- EndIf
- WEnd
- EndIf
- $tmp1 = ''
- FileClose($search)
- Next
- ; _GUICtrlTreeView_EndUpdate($hWndFrom)
- EndIf
- _GUICtrlStatusBar_SetText($hStatusBar, $PathCur)
- _GUICtrlStatusBar_SetTipText($hStatusBar, 0, $PathCur)
- _GUICtrlStatusBar_SetText($hStatusBar, $LngTmAs & ' ' & Round(TimerDiff($timer) / 1000, 2) & ' ' & $LngSec, 2)
- Else
- Return
- EndIf
- GUICtrlSendMsg($iListView, $LVM_SETCOLUMNWIDTH, 0, $LVSCW_AUTOSIZE)
- GUICtrlSendMsg($iListView, $LVM_SETCOLUMNWIDTH, 0, $LVSCW_AUTOSIZE_USEHEADER)
- ; Case $TVN_SINGLEEXPAND
- ; MsgBox(0, 'Message', '---')
- ; Case $NM_RCLICK
- ; Local $tMPos = _WinAPI_GetMousePos(True, $hWndFrom), $tHit = _GUICtrlTreeView_HitTestEx($hWndFrom, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
- ; Local $hItem = DllStructGetData($tHit, "Item")
- ; If $hItem <> -1 And $hItem<>0x0 Then
- ; MsgBox(0, 'Message', '---')
- ; $x = MouseGetPos(0)
- ; $y = MouseGetPos(1)
- ; DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hGui, "ptr", 0)
- ; Else
- ; Return
- ; EndIf
- EndSwitch
- Case $hListView
- Switch $iCode
- Case $NM_DBLCLK
- $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
- $iItem = DllStructGetData($tInfo, 'Index')
- If $iItem > -1 Then
- $tmp = $PathCur & '\' & _GUICtrlListView_GetItemText($hListView, $iItem)
- If FileExists($tmp) Then
- If _FO_IsDir($tmp) Then
- $timer = TimerInit()
- _Jump1($tmp)
- $PathCur = $tmp
- $timer = TimerInit()
- _ListView_Update()
- GUICtrlSetData($Address, $PathCur)
- _GUICtrlStatusBar_SetText($hStatusBar, $PathCur)
- _GUICtrlStatusBar_SetTipText($hStatusBar, 0, $PathCur)
- _GUICtrlStatusBar_SetText($hStatusBar, $LngTmAs & ' ' & Round(TimerDiff($timer) / 1000, 2) & ' ' & $LngSec, 2)
- Else
- ShellExecute('"' & $tmp & '"')
- EndIf
- EndIf
- EndIf
- EndSwitch
- EndSwitch
- $TrWM_NOTIFY = 0
- Return $GUI_RUNDEFMSG
- EndFunc ;==>WM_NOTIFY
- Func _ListView_Update()
- _GUICtrlListView_BeginUpdate($hListView)
- _GUICtrlListView_DeleteAllItems($hListView)
- $tmp = _FileListToArray($PathCur, "*", 2)
- If Not @error Then
- _AddItem($tmp, $PathCur, 1)
- EndIf
- $tmp = _FileListToArray($PathCur, "*", 1)
- If Not @error Then
- _AddItem($tmp, $PathCur)
- EndIf
- _GUICtrlListView_EndUpdate($hListView)
- EndFunc ;==>_ListView_Update
- Func _AddItem(ByRef $aFileList, $sPath, $fld = 0)
- Local $ext, $iExeNum = 0, $ind
- For $i = 1 To $aFileList[0]
- If $fld Then
- _GUICtrlListView_AddItem($hListView, $aFileList[$i], 0)
- Else
- $ext = StringRegExpReplace($aFileList[$i], '.*\.(\S+)', '\1')
- If $ext = 'exe' Or $ext = 'ico' Then
- $iExeNum += 1
- If $iExeNum < 10 Then
- _ReplaceIcon($g_hImgAssot, $sPath & '\' & $aFileList[$i], $iExeNum)
- $ind = $iExeNum - 10
- Else
- $ind = 0
- EndIf
- Else
- $ind = _Get_Num_ICO($ext)
- If @error Then $ind = 0
- EndIf
- _GUICtrlListView_AddItem($hListView, $aFileList[$i], $ind + 10)
- EndIf
- Next
- EndFunc ;==>_AddItem
- Func _ReplaceIcon($hWnd, $sFile, $iIndex = 2)
- Local $pIcon, $tIcon, $hIcon
- $tIcon = DllStructCreate("int Icon")
- $pIcon = DllStructGetPtr($tIcon)
- _WinAPI_ExtractIconEx($sFile, 0, 0, $pIcon, 1) ; извлекает иконку из файла
- $hIcon = DllStructGetData($tIcon, "Icon")
- _GUIImageList_ReplaceIcon($hWnd, $iIndex, $hIcon) ; -1 означает добавление иконки в конец списка, вместо замены
- _WinAPI_DestroyIcon($hIcon)
- EndFunc ;==>_ReplaceIcon
- Func _CreateItem($hWndFrom, $h, $Path)
- $text = _GUICtrlTreeView_GetText($hWndFrom, $h)
- $tmp = _FileListToArray($Path & '\' & $text, "*", 2)
- If @error Then Return
- For $i = 1 To $tmp[0]
- _GUICtrlTreeView_AddChild($hTreeView, $h, $tmp[$i], 0, 0)
- Next
- EndFunc ;==>_CreateItem
- Func _GetPathItem($hTreeView, $hItem)
- Local $sep = Opt("GUIDataSeparatorChar", "\")
- Local $sPath = _GUICtrlTreeView_GetTree($hTreeView, $hItem)
- Opt("GUIDataSeparatorChar", $sep)
- Return $sPath
- EndFunc ;==>_GetPathItem
- Func _restart()
- Local $sAutoIt_File = @TempDir & "\~Au3_ScriptRestart_TempFile.au3"
- Local $sRunLine, $sScript_Content, $hFile
- $sRunLine = @ScriptFullPath
- If Not @Compiled Then $sRunLine = @AutoItExe & ' /AutoIt3ExecuteScript ""' & $sRunLine & '""'
- If $CmdLine[0] > 0 Then $sRunLine &= ' ' & $CmdLineRaw
- $sScript_Content &= '#NoTrayIcon' & @CRLF & _
- 'While ProcessExists(' & @AutoItPID & ')' & @CRLF & _
- ' Sleep(10)' & @CRLF & _
- 'WEnd' & @CRLF & _
- 'Run("' & $sRunLine & '")' & @CRLF & _
- 'FileDelete(@ScriptFullPath)' & @CRLF
- $hFile = FileOpen($sAutoIt_File, 2)
- FileWrite($hFile, $sScript_Content)
- FileClose($hFile)
- Run(@AutoItExe & ' /AutoIt3ExecuteScript "' & $sAutoIt_File & '"', @ScriptDir, @SW_HIDE)
- Sleep(1000)
- Exit
- EndFunc ;==>_restart
- Func _FileDefaultIcon($sExt)
- If $sExt = '' Or StringInStr($sExt, ':') Then Return SetError(1)
- Local $aCall = DllCall("shlwapi.dll", "int", "AssocQueryStringW", _
- "dword", 0x00000040, _ ;$ASSOCF_VERIFY
- "dword", 15, _ ;$ASSOCSTR_DEFAULTICON
- "wstr", $sExt, _
- "ptr", 0, _
- "wstr", "", _
- "dword*", 65536)
- If @error Then Return SetError(1, 0, "")
- If Not $aCall[0] Then
- $sExt = StringReplace($aCall[5], '"', '')
- $sExt = StringSplit($sExt, ',')
- Opt('ExpandEnvStrings', 1)
- $sExt[1] = $sExt[1]
- Opt('ExpandEnvStrings', 0)
- Return SetError(0, 0, $sExt)
- ElseIf $aCall[0] = 0x80070002 Then
- Return SetError(1, 0, "{unknown}")
- ElseIf $aCall[0] = 0x80004005 Then
- Return SetError(1, 0, "{fail}")
- Else
- Return SetError(2, $aCall[0], "")
- EndIf
- EndFunc ;==>_FileDefaultIcon
- Func _ResizeField()
- Local $aClientSize, $aCur_Info, $aID_Pos, $dX, $tmp
- $aCur_Info = GUIGetCursorInfo($hGui)
- If $aCur_Info[4] = $ReLbl Then
- $aID_Pos = ControlGetPos($hGui, '', $ReLbl)
- $aClientSize = WinGetClientSize($hGui)
- $aClientSize[1] -= 60
- ; высчитываем разницу координат
- $dX = $aID_Pos[0] - $aCur_Info[0]
- While 1
- Sleep(10)
- $aCur_Info = GUIGetCursorInfo($hGui) ; получаем новую инфу
- $aCur_Info[0] += $dX
- If Not ($aCur_Info[0] < 60 Or $aClientSize[0] - $aCur_Info[0] < 60 Or $tmp = $aCur_Info[0]) Then
- GUICtrlSetPos($ReLbl, $aCur_Info[0], 35) ; устанавливаем новые координаты
- GUICtrlSetPos($iTreeView, 0, 35, $aCur_Info[0], $aClientSize[1])
- GUICtrlSetPos($iListView, $aCur_Info[0] + 4, 35, $aClientSize[0] - $aCur_Info[0] - 4, $aClientSize[1])
- $tmp = $aCur_Info[0]
- EndIf
- If Not $aCur_Info[2] Then ExitLoop ; выход если курсор отпущен
- WEnd
- EndIf
- EndFunc ;==>_ResizeField
- Func WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam)
- #forceref $iMsg, $wParam
- If $hWnd = $hGui Then
- Local $tMINMAXINFO = DllStructCreate("int;int;" & _
- "int MaxSizeX; int MaxSizeY;" & _
- "int MaxPositionX;int MaxPositionY;" & _
- "int MinTrackSizeX; int MinTrackSizeY;" & _
- "int MaxTrackSizeX; int MaxTrackSizeY", _
- $lParam)
- DllStructSetData($tMINMAXINFO, "MinTrackSizeX", 350)
- DllStructSetData($tMINMAXINFO, "MinTrackSizeY", 250)
- EndIf
- EndFunc ;==>WM_GETMINMAXINFO
- Func _Get_Num_ICO($sExt)
- ; Global $g_hImgAssot
- ; Global $g_aExtAssot
- Local $ind, $ico1
- $ind = _ArraySearch2($g_aExtAssot, $sExt)
- If @error Then
- $ico1 = _FileDefaultIcon('.' & $sExt)
- If Not @error Then
- Switch UBound($ico1)
- Case 2
- If _ArraySearch2($g_aExtBlack, $sExt) > 0 Then ; Если в чёрном списке, тогда ошибка
- Return SetError(1, 0, -1)
- Else
- _GUIImageList_AddIcon($g_hImgAssot, $ico1[1], 0)
- If @error Then
- _ArrayAdd2($g_aExtBlack, $sExt) ; Если ошибка, то добавляем расширение в чёрный список
- Return SetError(1, 0, -1)
- EndIf
- EndIf
- Case 3
- _GUIImageList_AddIcon($g_hImgAssot, $ico1[1], $ico1[2])
- If @error Then
- _ArrayAdd2($g_aExtBlack, $sExt) ; Если ошибка, то добавляем расширение в чёрный список
- Return SetError(1, 0, -1)
- EndIf
- EndSwitch
- _ArrayAdd2($g_aExtAssot, $sExt) ; Иначе добавляем расширение в белый список
- Return SetError(0, 0, $g_aExtAssot[0])
- ; MsgBox(4096, "Информация", "Количество изображений: " & _GUIImageList_GetImageCount($g_hImgAssot))
- ; $sText = ''
- ; For $i = 0 To $g_aExtAssot[0]
- ; $sText &= $g_aExtAssot[$i] & @LF
- ; Next
- ; MsgBox(0, 'Сообщение', $sText)
- EndIf
- Else
- Return SetError(0, 0, $ind)
- EndIf
- EndFunc ;==>_Get_Num_ICO
- Func _ArrayAdd2(ByRef $Array, $ext)
- $Array[0] += 1
- ReDim $Array[$Array[0] + 1]
- $Array[$Array[0]] = $ext
- EndFunc ;==>_ArrayAdd2
- Func _ArraySearch2(ByRef $Array, $ext)
- For $i = 1 To $Array[0]
- If $ext = $Array[$i] Then Return SetError(0, 0, $i)
- Next
- Return SetError(1, 0, -1)
- EndFunc ;==>_ArraySearch2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement