masterigor
02-09-2008, 02:46 PM
I am trying to make an AIM Client to resemble the actual AIM program. Basically the problem is that I have a Messagebox form where it has the message, who your sending it to, etc, and I'm trying to make an array of it so that you can press new message and im multiple people. I have a button that generates a new messaging window:
Private Sub Command3_Click()
screennamecount = screennamecount + 1
Set messagebox2(screennamecount) = New messagebox
messagebox2(screennamecount).Show
End Sub
The problem is I can't make it receive the messages. The actual Winsock control is on the Messagebox form and I tried using the code:
Private Sub mooSock1_IncomingInstantMessage(screenname As String, Message As String)
finalmessage = Mid(Mid(Message, 46), 1, Len(Mid(Message, 46)) - 21)
If Not messagebox2(0).Text2.Text = "" Then
messagebox2(0).Text2.Text = messagebox2(0).Text2.Text & vbCrLf & screenname & ":" & finalmessage
Else
messagebox2(0).Text2.Text = messagebox2(0).Text2.Text & screenname & ":" & finalmessage
End If
End Sub
however it gives me an error on the messagebox2(0) part, and I can't figure out why. Originally it was a loop where it would see how much messageboxes were loaded and it would check if the screen-name of the sender was the screen-name in the messagebox that the person was talking to, and if it was, it send message, so it was something like:
For I = 0 to screennamecount
if messagebox2(i).text1.text= screenname then
however it also give me an erorr on the messagebox2(I)
Private Sub Command3_Click()
screennamecount = screennamecount + 1
Set messagebox2(screennamecount) = New messagebox
messagebox2(screennamecount).Show
End Sub
The problem is I can't make it receive the messages. The actual Winsock control is on the Messagebox form and I tried using the code:
Private Sub mooSock1_IncomingInstantMessage(screenname As String, Message As String)
finalmessage = Mid(Mid(Message, 46), 1, Len(Mid(Message, 46)) - 21)
If Not messagebox2(0).Text2.Text = "" Then
messagebox2(0).Text2.Text = messagebox2(0).Text2.Text & vbCrLf & screenname & ":" & finalmessage
Else
messagebox2(0).Text2.Text = messagebox2(0).Text2.Text & screenname & ":" & finalmessage
End If
End Sub
however it gives me an error on the messagebox2(0) part, and I can't figure out why. Originally it was a loop where it would see how much messageboxes were loaded and it would check if the screen-name of the sender was the screen-name in the messagebox that the person was talking to, and if it was, it send message, so it was something like:
For I = 0 to screennamecount
if messagebox2(i).text1.text= screenname then
however it also give me an erorr on the messagebox2(I)