#include <GUIConstants.au3>
#include <Excel.au3>
#include <GuiListView.au3>
#include <GuiListView.au3>
$hMainGui = GUICreate('', 240, 170)
$ListView = GUICtrlCreateListView("Имя|Пароль", 10, 10, 220, 150)
$hListView = GUICtrlGetHandle($ListView)
GUISetState(@SW_SHOW, $hMainGui)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$PathFile = FileOpenDialog('Выбор файла EXCEL', @ScriptDir & '\', 'Файлы Excel (*.xls;*.xlsx)', 1)
If Not @error Then
$oExcel = _Excel_Open(False)
$oWorkbook = _Excel_BookOpen($oExcel, $PathFile)
$aResult = _Excel_RangeRead($oWorkbook, Default, Default, Default, True)
_Excel_BookClose($oWorkbook)
_Excel_Close($oExcel)
For $i = 0 To UBound($aResult) - 1
GUICtrlCreateListViewItem($aResult[$i][0] & '|' & $aResult[$i][1], $ListView)
Next
EndIf
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
EndSelect
WEnd
Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam)
#forceref $hWnd, $iMsg, $wParam
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $tInfo
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hListView
Switch $iCode
Case $NM_DBLCLK ; левый двойной клик мышкой по пункту
$tInfo = DllStructCreate($tagNMITEMACTIVATE, $lParam)
$Index = DllStructGetData($tInfo, "Index")
MsgBox(0, 'Пароль', _GUICtrlListView_GetItemText($ListView, $Index, 1))
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY