G
Guest
Hi,
I am still confused the different between ProcessCmdKey and
ProcessDialogKey. When to use it? I write a simple user control and these 2
override functions looks the same to me.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
if(msg.Msg == WM_KEYDOWN || msg.Msg == WM_SYSKEYDOWN)
{
switch(keyData)
{
case Keys.Alt | Keys.S:
MessageBox.Show("Alt+S");
break;
// some more cases...
}
}
return true;
}
==============================================
protected override bool ProcessDialogKey(Keys keyData)
{
switch(keyData)
{
case Keys.Alt | Keys.S:
MessageBox.Show("Alt+S");
break;
// some more cases... }
return true;
}
==============================================
Another thing, neither one of them capture "Alt+Tab" (Keys.Alt | Keys.Tab)
combinations. Anyone knows why? Or how to capture "Alt+Tab"?
Please advice, thanks!
-P
I am still confused the different between ProcessCmdKey and
ProcessDialogKey. When to use it? I write a simple user control and these 2
override functions looks the same to me.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
if(msg.Msg == WM_KEYDOWN || msg.Msg == WM_SYSKEYDOWN)
{
switch(keyData)
{
case Keys.Alt | Keys.S:
MessageBox.Show("Alt+S");
break;
// some more cases...
}
}
return true;
}
==============================================
protected override bool ProcessDialogKey(Keys keyData)
{
switch(keyData)
{
case Keys.Alt | Keys.S:
MessageBox.Show("Alt+S");
break;
// some more cases... }
return true;
}
==============================================
Another thing, neither one of them capture "Alt+Tab" (Keys.Alt | Keys.Tab)
combinations. Anyone knows why? Or how to capture "Alt+Tab"?
Please advice, thanks!
-P