Jump to content

Help Me Read ShortCut Icon In forder And show to Gui


Recommended Posts

#include<File.au3>

Opt('GUIOnEventMode', 1)
Global $aFileArray, $sFolder = @DesktopDir & '\' ;Folder to browse.
Global $hGui, $hList, $hListItems[1] = [1], $sDocsIcon

$hGui = GUICreate('File read Icon', 820, 620)
GUISetOnEvent(-3, '_Exit')
GUISetBkColor(0x515151)

$hList = GUICtrlCreateListView('Files                        .', 10, 10, 800, 600, 0x0000)

$hContextMenu = GUICtrlCreateContextMenu($hList)

GUICtrlCreateMenuItem('Open', $hContextMenu)
GUICtrlSetOnEvent(-3, '_Open')

$aFileArray = _FileListToArray($sFolder)
For $i = 1 To $aFileArray[0]
    $hListItems[0] += 1
    ReDim $hListItems[$hListItems[0]]
    $hListItems[$hListItems[0] - 1] = GUICtrlCreateListViewItem($aFileArray[$i], $hList)
    If StringInStr($aFileArray[$i], '.lnk', 2) Then ;If shortcut.
        $Icon = FileGetShortcut($sFolder & $aFileArray[$i])
        If Not @error Then GUICtrlSetImage($hListItems[$hListItems[0] - 1], $Icon[0], $Icon[5])
    ElseIf StringInStr($aFileArray[$i], '.doc', 2) Or StringInStr($aFileArray[$i], '.txt', 2) Then ;If .doc or .txt.
        GUICtrlSetImage($hListItems[$hListItems[0] - 1], $sDocsIcon)
    Else ;If .exe or other file type.
        ;If failed to get an icon then delete.
        If GUICtrlSetImage($hListItems[$hListItems[0] - 1], $sFolder & $aFileArray[$i]) = 0 Then GUICtrlDelete($hListItems[$hListItems[0] - 1])
    EndIf
Next

GUISetState()

While 1
    Sleep(10)
WEnd

Func _Exit()
    Exit
EndFunc   ;==>_Exit

Func _Open()
    $Active = StringTrimRight(GUICtrlRead(GUICtrlRead($hList)), 1)
    ShellExecute($sFolder & $Active)
EndFunc   ;==>_Open

This Code Is Show ShortCut Icon To Gui

But The File In Gui Is not Have Mouse Func And The File size Very Small

Can You Help Me Rewrite My Code  Same IMG 2

Pls Look My IMG

image.png

Thank  Brothers

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...