|
-
November 10th, 2004, 01:16 PM
#1
Storing a HANDLE in a CListCtrl
Can this be done and if so how? Trying to store the handle for each of my threads in a list control that also holds each threads corrisponding connecting ipaddress and port. (they are connecting to socket server connections)
I want to store the threads handle here so that I can send messages to the correct thread insead of broadcasting to all the threads.
Thanks
Tom
Thanks
Tom Wright
-
November 10th, 2004, 01:21 PM
#2
Re: Storing a HANDLE in a CListCtrl
 Originally Posted by tawright915
Storing a HANDLE in a CListCtrl Trying to store the handle for each of my threads in a list control that also holds each threads corrisponding connecting ipaddress and port.
You mean that you want to store that information with the list control - or with each item of the list control?
-
November 10th, 2004, 01:34 PM
#3
Re: Storing a HANDLE in a CListCtrl
with each item.
in my list I (so far) have three IP addresses that I'm connecting too via a thread for each one. I want to store the HANDLE for each thread in another sub-item on my list control.
Thanks
Tom
Thanks
Tom Wright
-
November 10th, 2004, 01:51 PM
#4
Re: Storing a HANDLE in a CListCtrl
 Originally Posted by tawright915
in my list I (so far) have three IP addresses that I'm connecting too via a thread for each one. I want to store the HANDLE for each thread in another sub-item on my list control.
First, you will need to create a class which represents an entry of your list - it will have the three IP addresses and the thread handle as members. Then you can associate pointers to instances of that class to each list control item - either with SetItemData / GetItemData, or as the lParam member of an LVITEM structure (depending on how you create / access the items).
-
November 10th, 2004, 03:19 PM
#5
Re: Storing a HANDLE in a CListCtrl
instead of creating a class, could I just not store the HANDLE in the LPARAM value for each item in my list?
Thanks
Tom Wright
-
November 10th, 2004, 03:36 PM
#6
Re: Storing a HANDLE in a CListCtrl
 Originally Posted by tawright915
instead of creating a class, could I just not store the HANDLE in the LPARAM value for each item in my list?
Yes - if the only thing you need to store is the handle. I understood that you also need to store the three IP addresses.
-
November 10th, 2004, 05:58 PM
#7
Re: Storing a HANDLE in a CListCtrl
Sorry for the confusion. I have a list control with three rows. One row is the IP address. The other is the port and the third will be an ID. So with the ID I can add the handle to the LPARAM value.
Thanks
Tom Wright
-
November 11th, 2004, 04:05 AM
#8
Re: Storing a HANDLE in a CListCtrl
 Originally Posted by tawright915
Sorry for the confusion. I have a list control with three rows.
Three rows - or three columns?
-
November 11th, 2004, 07:21 AM
#9
Re: Storing a HANDLE in a CListCtrl
did you try to use SetItemData
-
November 11th, 2004, 10:27 AM
#10
Re: Storing a HANDLE in a CListCtrl
Three columns....right? I have three different headers. One that says IP address, one that says Port and a third that says ID.
Columns go up and down and rows go horizontal. .....Right? I alwys get that confused.
Stam1...that was what I was planning on doing. Thanks
I'll try it out and let you guys know how it went.
Thanks for the help.
Thanks
Tom Wright
-
November 11th, 2004, 10:32 AM
#11
Re: Storing a HANDLE in a CListCtrl
 Originally Posted by tawright915
Three columns....right? I have three different headers. One that says IP address, one that says Port and a third that says ID.
Ok, so that are columns. Yes, columns are vertical, rows horizontal... 
 Originally Posted by tawright915
So with the ID I can add the handle to the LPARAM value.
Note that in a list control, the item data is always associated with the entire row, not with the sub items (the additional columns). So you would actually not assign the handle to "the ID", but to the entire item (the row).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|