473,394 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Disabling Function keys

Apologies if this has been covered recently - I lurked and saw nothing.

I have an application that does ticketing at a three-screen movie theatre,
and I'm using the function keys F1 thru F12 due to their intuitive layout.
I KeyPreview them to the form, and read them using the KeyDown event (since
KeyPress doesn't see non-ANSI keys). Everything works fine, EXCEPT.

After executing my code, a few of the keys go ahead with what they USUALLY
do (F1 brings up Help, F10 highlights the File menu choice, F11 brings up
the Database Window, and F12 does a Save As). I know I can disable F1=Help
at the OS level (XP here), but I don't want the user to have to do that on
his POS PC's. And the keys that act within Access (2000) have no apparent
way to disable them.

Is there something similar to CancelEvent that will stop the processing of a
keystroke after I'm done with it? Can I do this some other way?

Thanks for any ideas or novel approaches.

Armando

Nov 13 '05 #1
3 9116
Armando wrote:
Apologies if this has been covered recently - I lurked and saw nothing.

I have an application that does ticketing at a three-screen movie theatre,
and I'm using the function keys F1 thru F12 due to their intuitive layout.
I KeyPreview them to the form, and read them using the KeyDown event (since
KeyPress doesn't see non-ANSI keys). Everything works fine, EXCEPT.

After executing my code, a few of the keys go ahead with what they USUALLY
do (F1 brings up Help, F10 highlights the File menu choice, F11 brings up
the Database Window, and F12 does a Save As). I know I can disable F1=Help
at the OS level (XP here), but I don't want the user to have to do that on
his POS PC's. And the keys that act within Access (2000) have no apparent
way to disable them.

Is there something similar to CancelEvent that will stop the processing of a
keystroke after I'm done with it? Can I do this some other way?


No novel ideas. Set the KeyValue = 0 after you are done with it to
prevent further processing.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim intAltDown As Integer

intAltDown = (Shift And acAltMask) > 0
'Debug.Print acAltMask, KeyCode
If intAltDown And KeyCode = 84 Then
Me.cmdAddNew.Visible = Not Me.cmdAddNew.Visible 'toggle button
KeyCode = 0 ' disable additional processing
End If

End Sub

--
'---------------
'John Mishefske
'---------------
Nov 13 '05 #2
In the KeyDown event, after you detect and process the keystroke, destroy
the keystroke by setting KeyCode to zero, i.e.:
KeyCode = 0

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Armando" <ar*****@bogusaddress.com> wrote in message
news:LE*******************@news1.epix.net...
Apologies if this has been covered recently - I lurked and saw nothing.

I have an application that does ticketing at a three-screen movie theatre,
and I'm using the function keys F1 thru F12 due to their intuitive layout.
I KeyPreview them to the form, and read them using the KeyDown event
(since
KeyPress doesn't see non-ANSI keys). Everything works fine, EXCEPT.

After executing my code, a few of the keys go ahead with what they USUALLY
do (F1 brings up Help, F10 highlights the File menu choice, F11 brings up
the Database Window, and F12 does a Save As). I know I can disable
F1=Help
at the OS level (XP here), but I don't want the user to have to do that on
his POS PC's. And the keys that act within Access (2000) have no apparent
way to disable them.

Is there something similar to CancelEvent that will stop the processing of
a
keystroke after I'm done with it? Can I do this some other way?

Thanks for any ideas or novel approaches.

Armando

Nov 13 '05 #3
A thousand thanks to John, Allen, and anyone else who may reply. It works
like a charm. This is the sort of trick I knew you guys would have stashed
away. Now I have it, too!

Merry Christmas to all,

Armando
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Niels Borg | last post by:
Hi, I am building an app, where I would like to disable the standard windows function keys. I.E. F4 which expands a a selected drop-down list. Can anyone help me on that? Many thanks Niels...
1
by: Don W. | last post by:
I need to use some function keys as speed-keys (instead of clicking a button with the mouse.) Using this code doesn't display any codes for the function keys: <html><body> <SCRIPT...
1
by: Steve | last post by:
I would like to override the IsInputKey function in order to trap the arrow up/down keys in the Key Events. I understand that arrow keys don't have a char representation and thus, hard to trap. ...
4
by: Broeisi | last post by:
Hello, I'm trying to write a console based program in C in Linux. I want to use the function keys in my program, but I don;t know how to let the C program know when for exmaple the F1 key is...
1
by: apax999 | last post by:
Kinda new to SQL, using SQL Server 2005. I have some foreign keys in a couple of tables. I need to drop these tables, but can't since I'll get the error: Msg 3726, Level 16, State 1, Line...
1
by: Sam Samson | last post by:
Greeetings All .. For my users convenience I have mapped function keys F2 .. F12 to change the tabs on the Tabcontrol. Works like a charm <ominous musicuntil one hits F8</ominous music> ...
9
by: Wingot | last post by:
Hey, I am using Visual Studio 2008 Beta 2 for some application development in C#, but I presume that the following question applies equally well to any environment.
2
by: Gouri.Mahajan7 | last post by:
Hello, Can anybody please tell me how to disable the shortcuts of the internet explorer? I have hosted control on the web page and i want to give the inputs such as Ctrl+A, Ctrl+B and so on.....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.