473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

ProcessCmdKey vs ProcessDialogKey

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
1 11627
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jim | last post by:
I'm missing something, because I'm just not understanding this process. I'm using a Form (no derived controls or derived forms) and I want to catch the arrow keys. I've got the overridden...
1
by: Susanne Christe | last post by:
Hi Folks, I'm trying to override protected ProcessCmdKey function in writing my a custom MyDataGrid. I get the Keys I want, but it takes no effect to MyDataGrid, if I try for example execute...
0
by: Rachel Suddeth | last post by:
I have been overriding the ProcessCmdKey in my forms because I want to handle some keystrokes that seem to disappear if I try to use the regular key handling events. It seems to be working just...
4
by: jibran | last post by:
Hello. I have wrapped the DataGrid control with my own class (SmartDataGrid) adding some necessary functionality. My current webform has 2 SmartDataGrids. The first is populated by selected...
5
by: Colin Graham | last post by:
I am using the following code on my form to capture whether the tab control has been pressed. Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData...
2
by: Phil Galey | last post by:
I'm using the ProcessCmdKey event to capture various keys that are pressed. However, I'm having trouble capturing the combination of the CTRL key and, say, the DOWN key. If I just press the CTRL...
1
by: John Richardson | last post by:
I'm trying to override the SHIFT-SPACE "negative feature" in the Winforms datagrid, to only be a space. The following link describes this:...
5
by: Peted | last post by:
Hello, i am lookinf for the best way to trap any alphanumeric keypress in all multi key combminations and execute some code For example , i have a form visible using the form.showdialog...
2
by: Trooper | last post by:
Hi! I need help with calling ProcessCmdKey. I'm little bit confused how to use this method from my app. How to call it, from where? Can somebody explain to me? Thnx. This is the source:
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.