By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,361 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,361 IT Pros & Developers. It's quick & easy.

how disable F1 key

P: n/a
I need write simple program with work in background

and have only one function when it is run F1 I disable

and when I pres for example ctrl+k it (program is terminate)

maybe somebody have similar program or part of code I don't know

how get signal F1 pressing and neutralize it?
Nov 14 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
In article <cu**********@inews.gazeta.pl>, Dw70 <dw**@gazeta.pl> wrote:
:I need write simple program with work in background
:and have only one function when it is run F1 I disable
:and when I pres for example ctrl+k it (program is terminate)
:maybe somebody have similar program or part of code I don't know
:how get signal F1 pressing and neutralize it?

Anything like that would have to be quite dependant upon the
operating system involved -- C has no knowledge of what an F1 key
is [and neither does any POSIX or ISO standard that I am awae of.]

You did not specify the operating system, and it would be time-
consuming for us to list all the different ways that F1 might
be disabled on the operating system environments we know of.

My suspicion is that you mean to use this on one of the
Microsoft Windows environments. If so, then I suggest you examine
Microsoft documentation and Microsoft-specific newsgroups to find out
more about the technology involved. I have no idea how it's done
in current MS Windows environments; the technology that used to
be used was the 'TSR' ("Terminate and Stay Resident").

If you were programming for X Windows, such as for a Unix-based
graphics environment, then the general mechanism would be to push a new
transparent window onto the top of the window stack, with the window
set to receive keyboard events; you would probably want in such a case
to set it up to recognize by scan code rather than by key. You would
check the event handed to you, and if it was not one of the events you
are interested in, you would return a status code indicating that it
was okay to pass the event on to the next layer; for the events you
were interested in, you would "consume" the event. Recognizing by
scan-codes is tricky because it is less portable in the case of
different keyboards, but if you recognize by the full key then the X
key binding mechanism may already have mapped the F1 to something else,
if the user has an active 'modmap' [which is usually the case.] Of
course one of the difficulties with modmaps is that the user can map a
different key to perform whatever function of F1 it is that you are
trying to disable...

This problem, the possibility of modmaps, is not confined to
X: in Windows, it is fairly common for Microsoft and Logitech and
others to provide software that allows the keyboard or mouse to
be customized, so that keys perform different functions [e.g.,
if you wanted a Dvorak keyboard, or wanted to change the function
of the middle mouse button.] You have to ask yourself whether you
really want to just disable the F1 key, or if it is some function
invoked by pressing the key that you want to disable, seeing as
other keys might be programmed to produce that function. You should
also be asking yourself whether you want to disable F1 -totally-,
or if you just need it disabled when a certain program has "focus"
(the program that is being affected by the mouse and keyboard.)

--
WW{Backus,Church,Dijkstra,Knuth,Hollerith,Turing,v onNeumann}D ?
Nov 14 '05 #2

P: n/a
On Sat, 12 Feb 2005 21:49:58 +0100, in comp.lang.c , "Dw70"
<dw**@gazeta.pl> wrote:

how get signal F1 pressing and neutralize it?


interacting with funny keys is a FAQ - 19.5
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 14 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.