|
-
Dec 18th, 2001, 11:17 PM
#1
Thread Starter
New Member
Winsock in array quesiton
oooook here we go
I would like to make this simpler right now i have 4 different arrays which could be simplified all into a single array if i can get the answer to this..
how do you handle the controls of winsock (dataarival, connection) if its with in an array.
this is a sample of my array setup notice the winsock.
Type userdata
winsock As winsock
pos As posdata
stats As statdata
status As Integer
userinfo As userinfodata
End Type
Global users() As userdata
-
Dec 18th, 2001, 11:50 PM
#2
Hyperactive Member
-
Dec 19th, 2001, 02:56 AM
#3
Try making a "control" array then in the events it'll list an Index argument that will tell you which member of the array the event is coming from.
-
Dec 19th, 2001, 12:42 PM
#4
Thread Starter
New Member
yeah, but how will that work within a user type.
can you make an example?
-
Dec 19th, 2001, 02:04 PM
#5
Well it really wont, why does it need to be part of a UDT?
Or you could probably have the app create the array and assign it to the UDT. Although you may want to switch to a class and hae more control over what happens when values are assigned to the properties and what not, but that's just a suggestion.
VB Code:
Type userdata
winsock As winsock
pos As posdata
stats As statdata
status As Integer
userinfo As userinfodata
End Type
Global users() As userdata
'then when you are filling in your parts
set users(1).winsock=wsControlNameHere(1)
Although really it might be better to just store the index of the control array instead of a reference to an existing winsock control.
SO if users(1) maps to winsock(5) then just store the 5 in the winsock part of the UDT as a long instead of winsock and then when you want to use that person's winsock:
VB Code:
Type userdata
winsock As long 'notice the change
pos As posdata
stats As statdata
status As Integer
userinfo As userinfodata
End Type
Global users() As userdata
'then when you are filling in your parts
set users(1).winsock=wsControlNameHere(1).index
wsControlNameHere(users(1).winsock).SendData "Here you are"
Last edited by Edneeis; Dec 19th, 2001 at 02:09 PM.
-
Dec 19th, 2001, 05:09 PM
#6
Thread Starter
New Member
thanks, your example worked quite well.
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
|