First you should probably clarify which technology you're using: WinForms, WPF?
Anyway, using WinForms You can use the KeyDown
event to process such occurrences:
private void OnKeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (e.Shift && e.KeyCode == Keys.M)
{
WindowState = FormWindowState.Minimized;
}
}
Note that the modifier key/s and regular key/s you require to be pressed to carry out the action are obviously changeable.
A further note is that once this action has been executed then the window no longer has 'focus' and so repeating the keystrokes to display the window again will not work - for this to happen you will need to register a hot-key that Windows itself knows about or use a keyboard hook to intercept keystroke input to the system to consume in your application, AFAIK.