This commit is contained in:
陈皓 2018-12-26 17:53:25 +08:00
parent 0aef357ab2
commit 2fbacdf140

View File

@ -52,11 +52,12 @@ namespace HaoYue.BF3ChineseInput
public static extern IntPtr GetF(); //获得本窗体的句柄
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetForegroundWindow")]
public static extern bool SetF(IntPtr hWnd); //设置此窗体为活动窗体
private void timer1_Tick(object sender, EventArgs e)
{
if (this.Handle != GetF()) //如果本窗口没有获得焦点
SetF(this.Handle); //设置本窗口获得焦点
}
//private void timer1_Tick(object sender, EventArgs e)
//{
// if (this.Handle != GetF()) //如果本窗口没有获得焦点
// SetF(this.Handle); //设置本窗口获得焦点
//}
private void hook_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{