Jump to content

Recommended Posts

Posted

Hello community!

Can someone tell me why

#include <AutoItConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Array.au3>

GUICreate("123")
$List = GUICtrlCreateListView("", 10, 10)
_GUICtrlListView_AddColumn($List, "", 1000)
_GUICtrlListView_Scroll($List, 1000, 1000)
GUISetState(@SW_SHOW)
GUICtrlCreateListViewItem ( "AAA" , $List)

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

works well, but

#include <AutoItConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Array.au3>

GUICreate("123")
GUICtrlCreateListView("", 10, 10)
$List = ControlGetHandle ("123" , "", "SysListView321" )
_GUICtrlListView_AddColumn($List, "", 1000)
_GUICtrlListView_Scroll($List, 1000, 1000)
GUISetState(@SW_SHOW)
GUICtrlCreateListViewItem ( "AAA" , $List)

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Doesn't? (the item AAA is not added to the listview)

I tried to pass ControlGetHandle the 2 control ID formats:

[CLASS:SysListView32; INSTANCE:1]

SysListView321

Also, @error remains set to 0

Thank you!

Posted (edited)

Because GUICtrlCreateListViewItem() second parameter requires a control ID not a handle as you try to pass. You can use

_GUICtrlListView_AddItem($List, 'AAA')

if $List is a listview handle.

Edited by Andreik

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
×
×
  • Create New...