﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
3233	_GUICtrlListBox_GetSelCount returns 0 also if $hwnd isn't a handle	autoBert	guinness	"_GUICtrlListBox_GetSelCount returns 0 if no items selected. Helpfile say: Failure: -1 if no items are selected.
also if $hwnd isn't a handle 0 is returned. 
{{{
#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
	Local $idListBox

	; Create GUI
	GUICreate(""List Box Get Sel Count"", 400, 296)
	$idListBox = GUICtrlCreateList("""", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
	GUISetState(@SW_SHOW)

	; Add strings
	_GUICtrlListBox_BeginUpdate($idListBox)
	For $iI = 1 To 9
		_GUICtrlListBox_AddString($idListBox, StringFormat(""%03d : Random string"", Random(1, 100, 1)))
	Next
	_GUICtrlListBox_EndUpdate($idListBox)
	;Should show -1 but show 0
	;Helpfile: Failure: -1 if no items are selected.
	MsgBox($MB_SYSTEMMODAL, ""Information (no Item selected)"", ""Items Selected: "" & _GUICtrlListBox_GetSelCount($idListBox))

	; Select a few items
	_GUICtrlListBox_SetSel($idListBox, 3)
	_GUICtrlListBox_SetSel($idListBox, 4)
	_GUICtrlListBox_SetSel($idListBox, 5)

	;Should show -1 but show 0
	;Helpfile: Failure: -1 if no items are selected.
	;note the func is called with no hwnd so maybe in future use @error and @extended
	MsgBox($MB_SYSTEMMODAL, ""Information (no HWND)"", ""Items Selected: "" & _GUICtrlListBox_GetSelCount('1234'))

	; Show the item selection count
	MsgBox($MB_SYSTEMMODAL, ""Information (that's correct)"", ""Items Selected: "" & _GUICtrlListBox_GetSelCount($idListBox))

	; Loop until the user exits.
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE
	GUIDelete()
EndFunc   ;==>Example

}}}
"	Bug	closed		AutoIt	3.3.14.0	None	Fixed		
