hi, is there a way to get a standard winform app to detect if the shift key is being held down on application startup - without using windows hooks? I ideally would like the workflow to change from normal if the shift key is held down when the exe is run.
+2
A:
Check Control.ModifierKeys ...
[STAThread]
static void Main(string[] args)
{
if (Control.ModifierKeys == Keys.ShiftKey)
{
// Do something special
}
}
Jamie Ide
2009-06-09 00:25:53
Anyone care to explain why they downvoted my answer?
Jamie Ide
2009-06-09 11:46:54
+3
A:
The ModifierKeys property looks ideal:
private void Form1_Load(object sender, EventArgs e)
{
if ( (ModifierKeys & Keys.Shift) != 0)
{
MessageBox.Show("Shift is pressed");
}
}
Dan
2009-06-09 00:28:23