I want to trigger an action when a specific hotkey is pressed?
For example:
if the Ctrl+W key is pressed.
then display a messagebox.
I have searched the forum and someone asked a similar question but didn't get a answer...
So is this possible? And how should i do it?

Roy S194 reputationPosted Jan 21, 2011, 7:25 AM EST
private void Form1_KeyUp(object sender, KeyEventArgs e)
{
if (e.Modifiers == Keys.Control && e.KeyCode == Keys.W)
{
//do stuff
}
}
Btw: This will also work when a child control has the focus (so if the cursor is in a textbox, it will still work).
Hello World 023 reputationPosted Jan 21, 2011, 8:59 AM EST
and i want to use it to show and hide my form.
example:
when i press control+w
If the form is not hidden show it else hide the form
Suthish NairRank #92 · 22.8K reputationPosted Jan 21, 2011, 9:24 AM EST
1 2 3
Hello World 023 reputationPosted Jan 21, 2011, 12:46 PM EST
i'll have checked the links you posted. But i'm new to programming so i don't understand much of it..
But i did found this on the website:
http://www.c-sharpcorner.com/UploadFile/rafaelwo/1590/
And i hope i can modify that or figure out how that works..
Bye
Hello World 023 reputationPosted Jan 22, 2011, 10:40 AM EST
But i did not find a way to use a mouse combination as a hotkey..
Does anyone knows if it that is possible?
Cause i only saw that you can use alt ctrl shift and win as modifier key's