• Welcome to Valhalla Legends Archive.
 

Beep On Keyascii13

Started by ObsidianWolf, November 25, 2003, 08:16 PM

Previous topic - Next topic

ObsidianWolf

when i press enter to send the text on my bot the computer does that annoying ding sound.  how can I stop this from happening?  Im using VB6

Spht

Returning zero (0) to KeyAscii parameter will let it know you got the message and not beep.

ObsidianWolf

That worked great, thanks
Code for those that might run into same deal.

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    AddChat vbWhite, "<" & varAccount & "> ", vbCyan, Text1.text


With Packet
   .InsertNTString Text1.text
   .SendPacket &HE
   Text1.text = ""
End With
End If
KeyAscii=0
End Sub




iago

Just a comment:

instead of 13, you should have vbKeyEnter or vbEnter or something like that.

Not a big deal, just thought I'd mention it :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Spht

vbKeyReturn -- Yes it's better to use constants. Makes reading your code much easier.

Dyndrilliac

Quote from: iago on November 25, 2003, 08:27 PM
Just a comment:

instead of 13, you should have vbKeyEnter or vbEnter or something like that.

Not a big deal, just thought I'd mention it :)
.

Learn something new everyday - I was not aware that would work; So which is it? vbEnter or vbKeyEnter? :P
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

ObsidianWolf


Spht

Quote from: ObsidianWolf on November 25, 2003, 08:32 PM
vbenter


No, vbEnter = 0. He's looking for vbKeyReturn, which = 13.

ObsidianWolf

whoops my bad, thanks for the correction.

Dyndrilliac

Could I do the same thing with Alt? Like, vbKeyAlt? Or is it something different?
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

TriCk

Dyndrilliac, you sure could, it would just make Alt send instead of Enter

Skywing

#11
Quote from: TriCk on November 26, 2003, 06:34 AM
Dyndrilliac, you sure could, it would just make Alt send instead of Enter
Note that alt is a modifier and doesn't have an (ASCII/Unicode) keycode of it's own.