|
-
Mar 25th, 2005, 01:24 PM
#1
Thread Starter
Fanatic Member
How to write sentences in Ascii code
I recently got the idea to write a program that changes everything you type into something else. I tried writing it and it didn't work, but I know it can be done. If someone knows how to do this reply please...
Here is my code
Code:
Private Sub Form_keypress(keyascii As Integer)
If (keyascii >= 32) And (keyascii <= 126) Then
keyascii = ' what i make it say
End If
End Sub
I need to make it work.
-
Mar 25th, 2005, 01:38 PM
#2
Re: How to write sentences in Ascii code
Welcome to the forums.
Do you mean something like this?
VB Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 32) And (KeyAscii <= 126) Then
MsgBox Chr(72) & Chr(97) & Chr(99) & Chr(107)
End If
End Sub
Edit If you are going to use the Form Keypress event as make sure you have the form's KeyPreview property set to true.
Last edited by Hack; Mar 25th, 2005 at 01:44 PM.
-
Mar 25th, 2005, 01:42 PM
#3
Re: How to write sentences in Ascii code
You may generate a random number and set new keyascii:
VB Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
Randomize
If (KeyAscii >= 32) And (KeyAscii <= 126) Then
KeyAscii = Int((126 * Rnd) + 32)
End If
End Sub
-
Mar 25th, 2005, 01:44 PM
#4
Re: How to write sentences in Ascii code
Or better yet use all available characters:
VB Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
Randomize
KeyAscii = Int((255 * Rnd) + 1)
End Sub
-
Mar 25th, 2005, 01:45 PM
#5
Re: How to write sentences in Ascii code
... or just add or substract a value.
VB Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 32) And (KeyAscii <= 126) Then
If KeyAscii > 80 Then
KeyAscii = KeyAscii - 5
Else
KeyAscii = KeyAscii + 5
End If
End If
End Sub
... or whatever...
-
Mar 25th, 2005, 02:24 PM
#6
Thread Starter
Fanatic Member
Re: How to write sentences in Ascii code
Thanks for the help, but I am trying to write a program that changes everything you type (no matter where you type it) it comes out as something I make it say. I want it to do that + set the form to not be visible. But thanks again for the help.
-
Mar 25th, 2005, 02:26 PM
#7
Re: How to write sentences in Ascii code
 Originally Posted by Sir Loin
Thanks for the help, but I am trying to write a program that changes everything you type (no matter where you type it) it comes out as something I make it say. I want it to do that + set the form to not be visible. But thanks again for the help.
This sounds a little suspect to me. For what purpose do you need to accomplish this goal?
-
Mar 25th, 2005, 03:07 PM
#8
Thread Starter
Fanatic Member
Re: How to write sentences in Ascii code
It does doesn't it...
I just want to code a program like that to joke around with my friends and learn how to use KeyPress with sentences in ASCII code rather than one letter.
-
Mar 25th, 2005, 03:14 PM
#9
Re: How to write sentences in Ascii code
that is not a joke. do it in your program as a joke. they will know that you are responsible, and laugh if the want.
-
Mar 25th, 2005, 03:45 PM
#10
Re: How to write sentences in Ascii code
 Originally Posted by Sir Loin
... but I am trying to write a program that changes everything you type (no matter where you type it) it comes out as something I make it say. I want it to do that + set the form to not be visible. ...
This also sounds like malicious to me ... Sorry.
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
|