#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#Include <WinAPIEx.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Библиотека Игр", 487, 397, 319, 133, BitOR($WS_MINIMIZEBOX, $WS_POPUP, $WS_GROUP), $WS_EX_TOOLWINDOW);288, 225, 192, 124
GUISetBkColor(0x282828)
;~ GUIRegisterMsg($WM_NCHITTEST, 'WM_NCHITTEST')
$ListView1 = GUICtrlCreateListView("", 1, 32, 485, 364)
GUICtrlSetStyle($ListView1, BitOR($LVS_SINGLESEL, $LVS_ICON), BitOR($LVS_EX_FLATSB, $LVS_EX_DOUBLEBUFFER, $LVS_EX_SNAPTOGRID))
$ListView1context = GUICtrlCreateContextMenu($ListView1)
$Add = GUICtrlCreateMenuItem("Добавить", $ListView1context)
$Delete = GUICtrlCreateMenuItem("Удалить", $ListView1context)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$Settings = GUICtrlCreateButton("Н", 214, -4, 24, 24)
GUICtrlSetBkColor(-1, 0x333333)
GUICtrlSetColor(-1, 0x008080)
$Exit = GUICtrlCreateButton("X", 262, -4, 24, 24)
GUICtrlSetBkColor(-1, 0x333333)
GUICtrlSetColor(-1, 0x008080)
$Minimize = GUICtrlCreateButton("_", 238, -4, 24, 24)
GUICtrlSetBkColor(-1, 0x333333)
GUICtrlSetColor(-1, 0x008080)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $sIni_File = @ScriptDir & '\Settings.ini' ;Хранение файла
Global $var = IniReadSection($sIni_File, 'Game'), $iDouble_Click_Event = False
icon()
Func icon()
For $q = 1 To $var[0][0]
Local $aIcon[2], $sIcon = $var[$q][1], $aRes, $iCount
If Not FileExists($sIcon) Then Exit 13
$aRes = DllCall('shell32.dll', 'uint', 'ExtractIconExW', 'wstr', $sIcon, 'int', -1, 'ptr', 0, 'ptr', 0, 'uint', 1)
If (@error) Or (Not $aRes[0]) Then Exit 13
$iCount = $aRes[0]
For $i = 0 To $iCount - 1
For $j = 0 To 1
$aIcon[$j] = _WinAPI_ExtractIcon($sIcon, $i, $j)
If @error Then ExitLoop
Next
If Not @error Then _WinAPI_SaveHICONToFile(@ScriptDir & '\Resource\' & $var[$q][0] & '.ico', $aIcon)
For $j = 0 To 1
If $aIcon[$j] Then _WinAPI_DestroyIcon($aIcon[$j])
Next
Next
Next
Start()
EndFunc
Func Start();Загрузка файла
$hImage = _GUIImageList_Create(32, 32)
If @error Then
MsgBox(4096, "", "Произошла ошибка, возможно отсутствует INI-файл.")
Else
For $i = 1 To $var[0][0]
_GUICtrlListView_AddItem($ListView1, $var[$i][0], _GUIImageList_AddIcon($hImage, @ScriptDir & "\Resource\" & $var[$i][0] & ".ico", '', True))
Next
_GUICtrlListView_SetImageList($ListView1, $hImage, 1)
EndIf
EndFunc ;==>Start
While 1
$q = Number(_GUICtrlListView_GetSelectedIndices($ListView1))
$file = _GUICtrlListView_GetItemText($ListView1, $q, 0)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Exit
Exit
EndSwitch
If $iDouble_Click_Event Then
$iDouble_Click_Event = 0
$textgame = IniRead ($sIni_File, "Game", $file, "" )
$sRes = StringLeft($textgame, StringInStr($textgame, "\", 2, -1)-1)
TrayTip("Игры", "Запуск игры " & $file, 5, 1)
Sleep(3000)
ShellExecute($textgame, "", $sRes); запускаем
EndIf
WEnd
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView = $ListView1
If Not IsHWnd($ListView1) Then $hWndListView = GUICtrlGetHandle($ListView1)
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hWndListView
Switch $iCode
Case $NM_CLICK
$iOne_Click_Event = True
Case $NM_DBLCLK
$iDouble_Click_Event = True
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY