|
-
Dec 12th, 2006, 09:53 AM
#1
Thread Starter
Hyperactive Member
Disable keys
Hi,
i currently have a program, it will run full screen so it cannot be closed without the use of a button, i want something that will disable ALL keys apart from the few keys i want to be enabled, is there a way to do this and if so how?
as an example if possible lets say the letters A,B,C, will be all unblocked.
thanks
lee
If a post has been usefull then Rate it! 
-
Dec 12th, 2006, 10:36 AM
#2
Hyperactive Member
Re: Disable keys
you could make a list of all keys, and use "for each" to filter A, B and C out.
and just search the forum for the code to disable the keys.
-
Dec 12th, 2006, 03:39 PM
#3
Member
Re: Disable keys
In the Form_KeyPress event, put code similar to the following:
VB Code:
If KeyAscii = 97 Then
'A Key was pressed, so do something
ElseIf KeyAscii = 98 Then
'B Key was pressed, do something else
ElseIf KeyAscii = 99 Then
'C Key was pressed, do yet another thing
Else
KeyAscii = 0
End If
-
Dec 12th, 2006, 04:08 PM
#4
Thread Starter
Hyperactive Member
Re: Disable keys
Thanks mark thats very useful
If a post has been usefull then Rate it! 
-
Dec 12th, 2006, 04:25 PM
#5
Re: Disable keys
To make MarkDorf's code more readable use VB's built in constants
VB Code:
If KeyAscii = vbKeyA Then
'A Key was pressed, so do something
ElseIf KeyAscii = vbKeyB Then
'B Key was pressed, do something else
ElseIf KeyAscii = vbKeyC Then
'C Key was pressed, do yet another thing
Else
KeyAscii = 0
End If
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Dec 12th, 2006, 04:49 PM
#6
Fanatic Member
Re: Disable keys
In case you need the Full ASCII table
Alpha Micro: Alpha Basic, AS400 V5r2, EDI (Trusted Link/ Inovis.com),Access AS/400 via VB6, Qbasic for data conversions. A mix of Hardware too. ASCII Table , New Number to Words/66 digits , AS/400(v5r2) VB6 Viewer/Ask for code(ODBC) ^ What Is Transferring? , Check your Ports #Perfect Passwords , *Slide Bar Example , Logoff, Restart, Shut-Down PC *Keep Form On Top , Opaque Form ^ Create Objects at Run Time @ Check Key Caps Locks # GetTickCount(System Up Time) * Convert text to Excel & Collected Icons + Resize: Form/Text box ^ PC GateWay via Shell $ Drag & Drop Game ! PopUpMenu *Print File/no Open# Timer on Mult Forms ~ Splash & Mult Forms & Lots of Comments + Random/Timer/Guess * Dec >Hex >Oct >Bin % Get MAC (NIC) < saving to Registry > Wookiee Cookies \ BackUpDisk / World Conection SpeedTest $ Glossary Commonly Used Terms # phonetic list @ Detailed Computer Scan
When posting Code, Use tags.. [CODE] *Your Code* [/CODE]
-
Dec 12th, 2006, 07:14 PM
#7
Thread Starter
Hyperactive Member
Re: Disable keys
thanks (yeah i already had an ascii table but this one it much easier thanks)
If a post has been usefull then Rate it! 
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
|