|
-
Apr 12th, 2004, 10:41 AM
#1
Thread Starter
Hyperactive Member
winsock "fred is typing." question :) [resolved]
Hi,
I have a winsock p2p chat app and want to replicate the common messenger feature that tells a user when the other is typing.
What do you think the best way to do this would be? I've tried playing with
Private Sub txtMessage_Change()
but with little or no luck.
Any ideas?
Simon
Last edited by simonp; Apr 12th, 2004 at 11:27 AM.
-
Apr 12th, 2004, 10:49 AM
#2
Not NoteMe
I suggest having a timer on the form, that looks at the current text in your textbox, if it changed from the last time it looked (and it's not empty), then send a small amount of data saying 'User is typing'.
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe
"I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Have I helped you? Please Rate my posts. 
-
Apr 12th, 2004, 10:50 AM
#3
Probably best to set a timer, for say, 1 second, before you send the blank message. If you have 2 PC's next to each other, and have them both on msn, youll see that even when you stop typing, it doesn't automatically inform the other user.
VB Code:
Dim kDown As Boolean
Private Sub Timer1_Timer()
If Not kDown Then
'send the blank message
Else
'send the typing message
End If
End Sub
Private Sub txtMessage_KeyDown(KeyCode As Integer, Shift As Integer)
kDown = True
End Sub
Private Sub txtMessage_KeyUp(KeyCode As Integer, Shift As Integer)
kDown = False
End Sub
It might not be the best way, but give it a shot..
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 12th, 2004, 11:04 AM
#4
Or reset the flag in the timer
VB Code:
Private IsTyping
Private Text1_Keypress(KeyAscii As Integer)
IsTyping = True
End Sub
Private Timer1_Timer()
If IsTyping Then
WinSock.Send "Is typing."
IsTyping = False '<------
Else
Winsock.Send "No longer typing
End If
End Sub
-
Apr 12th, 2004, 11:27 AM
#5
Thread Starter
Hyperactive Member
Thanks everyone.
leinad31 - your solution was great and is working perfectly.
Simon
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
|