#SendMessage by User Forced & When F1 KeyDown, Process example
#SendMessage by User Forced & When F1 KeyDown, Process example
#SendMessage by User Forced & When F1 KeyDown, Process example


KEY_DOWN시에, 강제로 Message를 Send 한다.
WM_KEYDOWN시에, F1이 눌리면 F1이 눌렸다고 표시한다.

private const int WM_KEYDOWN        = 0x0100;

protected override void WndProc(ref Message m)
{
  base.WndProc(ref m);

  Console.WriteLine(m.Msg); //10진수로 표시
  Console.WriteLine("0x"+Convert.ToString(m.Msg, 16)); //16진수로 표시

  switch(m.Msg)
  {
    case 0x0203 : 
      Console.WriteLine("WM_LBUTTONDBLCLK      "); 
      Console.WriteLine("QUIT--------------------------------"); 
      Application.Exit(); //강제종료
      break;
    case 0x0100 : 
    Console.WriteLine("WM_KEYDOWN ####           ---------------"); 
    ____KingDom.SendMessage(this.Handle, WM_COPYDATA, 1, 2);

    if (m.Msg == WM_KEYDOWN)
    {
      Keys keyCode = (Keys)m.WParam & Keys.KeyCode;

      if(Keys.F1 == keyCode)
      {
        Console.WriteLine("F1 Key Pressed!!");
      }
    }
    break;
  }
}

 

send_msg.cs
0.03MB

+ Recent posts