[.net] how to disable the default shortcut keys?
hi guys,
i want to impart the key 'Alt' some specific function, but every time it was pressed the menu would be actived automatically, cause it is the default shortcut key for accessing the menu.
so is there any way that i can disable the default shortcut? thank you!
sorry for my poor english.
hey there, i think the "check this out" is great, but it's in c++. i just can't get it. and what's PInvoke?
many thanks!
many thanks!
PInvoke is a way of referencing 'ordinary' dll's and invoking their methods.
PInvoke article
For exellent help with PInvoke see this
It has a great plugin for VS and a lot of help.
For the method SetWindodsHookEx see this
Cheers
PInvoke article
For exellent help with PInvoke see this
It has a great plugin for VS and a lot of help.
For the method SetWindodsHookEx see this
Cheers
You don't need to call anything externally. Just override ProcessCmdKey from the form.
I have something where I want Alt + mouse button to do something without focusing the menu bar, but at the same time I wanted to be able to hit "Alt-F" to jump to "File" in the menu. So what I did was strip the Alt and Menu modifier from the keyData unless a letter was pressed too. KeyDown, KeyUp, KeyPress will work as normal.
protected override bool ProcessCmdKey(ref Message msg,Keys keyData)
{
//This is a bit ugly for stripping out the modifiers but it works.
int num=((int)keyData)&0xFF;
if(num<(int)Keys.A || num>(int)Keys.Z)
{keyData=keyData&(~Keys.Menu)&(~Keys.Alt);}
return base.ProcessCmdKey(ref msg,keyData);
}
I have something where I want Alt + mouse button to do something without focusing the menu bar, but at the same time I wanted to be able to hit "Alt-F" to jump to "File" in the menu. So what I did was strip the Alt and Menu modifier from the keyData unless a letter was pressed too. KeyDown, KeyUp, KeyPress will work as normal.
protected override bool ProcessCmdKey(ref Message msg,Keys keyData)
{
//This is a bit ugly for stripping out the modifiers but it works.
int num=((int)keyData)&0xFF;
if(num<(int)Keys.A || num>(int)Keys.Z)
{keyData=keyData&(~Keys.Menu)&(~Keys.Alt);}
return base.ProcessCmdKey(ref msg,keyData);
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement