Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable a key

Status
Not open for further replies.

jareyes

Programmer
May 30, 2001
1
ES
I´m developing an application for a system that will be runnig in a PC, this application will be used for non-qualified users.I want to disable some keys and key combinations in it. How can i do it?.
for example: disable the windows key or the alt-F4 combination
 
Look into PreTranslateMessage... i think this is the path you will want to follow

Matt
 
Hi

the function PreTranslateMessage is used by the class that received the message to translate the message before they are dispatched. This gives the opportunity to the class to trap the message as, when the function returns TRUE, the message is not dispatched.

Here is a sample code for a dialog box:

BOOL C....Dlg::preTranslateMessage(MSG* pMsg)
{

// Select Only WM_KEYDOWN Message

if ( pMsg->message == WM_KEYDOWN)
{
// Select ESC and Enter Key

if (( pMsg->wParam == VK_RETURN) || ( pMsg->wParam == VK_ESCAPE))
return TRUE;
}

return CDialog::preTranslateMessage(pMsg);
}

HTH

Thierry
EMail: Thierry.Marneffe@swing.be
WebSite:
 
Hi guis, as I see this is about disable it not in an aplication but in the keyboard.
I think you should implement some interfaces like IShell* ant register them to run at startup. There exists posibility to hahdle system events. John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top