#include "WinAPI.au3"
$par='a1&b2&c3&d4&e5&f6&g7'
ConsoleWrite( PopUp($par)& @LF)
func PopUp($string)
$WS_POPUP = 0x80000000
$WS_BORDER = 0x00800000
$WS_CLIPSIBLINGS = 0x04000000
$WS_EX_TOPMOST = 0x00000008
$WS_EX_WINDOWEDGE = 0x00000100
$LB_GETCARETINDEX = 0x019F
$LB_GETTEXTLEN = 0x018A
$LB_GETTEXT = 0x0189
$WS_VSCROLL = 0x00200000
$Form1 = GUICreate("SelEntri", 158, 110, 500, 500, BitOR($WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
$List1 = GUICtrlCreateList("", 0, 0, 158, 120,BitOR($WS_VSCROLL,$WS_BORDER))
$line=StringRegExpReplace($string,'&','|')
GUICtrlSetData($List1, $line)
GUISetState(@SW_SHOW)
GUICtrlSetData($List1, "Выход")
$mousepos=MouseGetPos()
WinMove('SelEntri','',$mousepos[0], $mousepos[1])
$Lhwnd=GUICtrlGetHandle($List1)
While 1
$nMsg = GUIGetMsg()
if $nMsg= $List1 then
$iIndex=_GUICtrlListBox_GetCaretIndex($Lhwnd)
local $data=_GUICtrlListBox_GetText($Lhwnd, $iIndex)
;~ ConsoleWrite('>>' & $data& @LF)
If $data='Выход' then Return 0
Return $data
EndIf
WEnd
EndFunc
Func _GUICtrlListBox_GetCaretIndex($hWnd)
;~ If $Debug_LB Then __UDF_ValidateClassName($hWnd, $__LISTBOXCONSTANT_ClassNames)
If IsHWnd($hWnd) Then
Return _SendMessage($hWnd, 0x019F)
Else
Return GUICtrlSendMsg($hWnd, 0x019F, 0, 0)
EndIf
EndFunc ;==>_GUICtrlListBox_GetCaretIndex
Func _GUICtrlListBox_GetText($hWnd, $iIndex)
;~ If $Debug_LB Then __UDF_ValidateClassName($hWnd, $__LISTBOXCONSTANT_ClassNames)
Local $tText = DllStructCreate("wchar Text[" & _GUICtrlListBox_GetTextLen($hWnd, $iIndex) + 1 & "]")
If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
_SendMessage($hWnd, 0x0189, $iIndex, DllStructGetPtr($tText), 0, "wparam", "ptr")
Return DllStructGetData($tText, "Text")
EndFunc ;==>_GUICtrlListBox_GetText
Func _GUICtrlListBox_GetTextLen($hWnd, $iIndex)
;~ If $Debug_LB Then __UDF_ValidateClassName($hWnd, $__LISTBOXCONSTANT_ClassNames)
If IsHWnd($hWnd) Then
Return _SendMessage($hWnd, 0x018A, $iIndex)
Else
Return GUICtrlSendMsg($hWnd, 0x018A, $iIndex, 0)
EndIf
EndFunc ;==>_GUICtrlListBox_GetTextLen