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

ProcessCmdKey vs ProcessDialogKey

P: n/a
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
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
yyy
Maybe this will help you:
http://www.neowin.net/forum/index.php?showtopic=264309

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.