Jump to content
Sign in to follow this  

about _CoProc()'s parameter's passing

Recommended Posts


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.

#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


Func _Main()
    Local $hListView

    GUICreate("ListView Get Item Count", 400, 300)
    $hListView = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268)

    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
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc   ;==>_Main

Func Test_1($hListView)
    MsgBox(1, 1, $hListView)
    MsgBox(1, 1, _GUICtrlListView_GetItemCount($hListView))
EndFunc   ;==>Test_1

Share this post

Link to post
Share on other sites

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?

Share this post

Link to post
Share on other sites

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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.