zhaicheng Posted January 28, 2011 Share Posted January 28, 2011 I pass the listview‘s handle to a function Test_1 ; however it does not recognize it. Any suggestions? My purpose of doing this is that the listview needs constantly being updated according to exterior data. Or you have a better suggestion? I appreciate your help all the time. expandcollapse popup#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include "CoProc.au3" Opt('MustDeclareVars', 1) $Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work _Main() Func _Main() Local $hListView GUICreate("ListView Get Item Count", 400, 300) $hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268) GUISetState() GUICtrlCreateListViewItem("line1|data1|more1", $hListView) GUICtrlCreateListViewItem("line2|data2|more2", $hListView) GUICtrlCreateListViewItem("line3|data3|more3", $hListView) GUICtrlCreateListViewItem("line4|data4|more4", $hListView) GUICtrlCreateListViewItem("line5|data5|more5", $hListView) MsgBox(4160, "Information", "Item Count: " & _GUICtrlListView_GetItemCount($hListView)) _CoProc("Test_1", GUICtrlGetHandle($hListView)) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Main Func Test_1($hListView) MsgBox(1, 1, $hListView) MsgBox(1, 1, _GUICtrlListView_GetItemCount($hListView)) EndFunc ;==>Test_1 Link to comment Share on other sites More sharing options...
KaFu Posted January 28, 2011 Share Posted January 28, 2011 Maybe its passed as a string? Try a IsHwnd() in the Coproc function to check if the var is a handle, maybe something like $hwnd = hwnd($hwnd) will work? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now