0
이 응용 프로그램이 백그라운드에있을 때보 다 F10을 클릭하면 루프가있는 기능이 시작될 것입니다. 백그라운드에서 프로그래밍 할 바로 가기 키 보내기
이
내 코드입니다 :namespace test
{
public partial class Form1 : Form
{
[DllImport("user32.dll")]
public static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);
[DllImport("user32.dll")]
public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
public Form1() //(lub Form1_Load(object sender, System.EventArgs e))
{
RegisterHotKey(this.Handle,9000, 2, (int) Keys.F10);
InitializeComponent();
}
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
UnregisterHotKey(this.Handle,9000);
UnregisterHotKey(this.Handle,9001);
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
switch (m.Msg)
{
case 0x312:
switch (m.WParam.ToInt32())
{
case 9000:
//code
break;
case 9001:
//code
break;
}
break;
}
}
}
}
하지만 작동하지 않습니다 :(
당신이 제발 도와 드릴까요
작동하지 않는 부분에 대해 자세히 설명하십시오. – cadrell0
내부 함수 WndProc로 이동하지만 절대 9000 및 9001이 표시되지 않습니다. – cadi2108
이것을 중복으로 표시하지는 않겠지 만 관련이있을 수 있습니까? http://stackoverflow.com/questions/6664420/f10-key-is-not-caught – cadrell0