how disable F1 key

D

Dw70

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?
 
W

Walter Roberson

: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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top