23333
This commit is contained in:
parent
2fbacdf140
commit
d9013e661b
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -5,9 +5,9 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:HaoYue.BF3ChineseInput"
|
xmlns:local="clr-namespace:HaoYue.BF3ChineseInput"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="MainWindow" Height="450" Width="800">
|
Title="MainWindow" Height="95.195" Width="376.122">
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBox x:Name="text1" HorizontalAlignment="Left" Height="23" Margin="67,96,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>
|
<TextBox x:Name="text1" HorizontalAlignment="Left" Height="23" Margin="584,752,-473,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="681"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -37,22 +37,33 @@ namespace HaoYue.BF3ChineseInput
|
|||||||
char i = e.KeyChar;
|
char i = e.KeyChar;
|
||||||
//System.Windows.Forms.MessageBox.Show(i.ToString());
|
//System.Windows.Forms.MessageBox.Show(i.ToString());
|
||||||
|
|
||||||
|
//text1.Text += i;
|
||||||
|
|
||||||
text1.Text += i;
|
text1.Text += i;
|
||||||
|
|
||||||
//判断按下的键(Alt + A)
|
//判断按下的键(Alt + A)
|
||||||
if (i == 'j' && (int)System.Windows.Forms.Control.ModifierKeys == (int)Keys.Alt)
|
//if (i == 'j' && (int)System.Windows.Forms.Control.ModifierKeys == (int)Keys.Alt)
|
||||||
{
|
//{
|
||||||
System.Windows.Forms.MessageBox.Show("ddd");
|
// text1.Text += i;
|
||||||
}
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
|
////判断按下的键(Alt + A)
|
||||||
|
//if (i == 'j' || i == 'k' || i == 'l')
|
||||||
|
//{
|
||||||
|
// //int pid = 0;//获取当前进程的PID
|
||||||
|
// //GetWindowThreadProcessId(GetForegroundWindow(), out pid);
|
||||||
|
// SetForegroundWindow(new IntPtr(21404));
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "GetForegroundWindow", CharSet = System.Runtime.InteropServices.CharSet.Auto, ExactSpelling = true)]
|
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "GetForegroundWindow", CharSet = System.Runtime.InteropServices.CharSet.Auto, ExactSpelling = true)]
|
||||||
public static extern IntPtr GetF(); //获得本窗体的句柄
|
public static extern IntPtr GetForegroundWindow(); //获得本窗体的句柄
|
||||||
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetForegroundWindow")]
|
|
||||||
public static extern bool SetF(IntPtr hWnd); //设置此窗体为活动窗体
|
|
||||||
|
|
||||||
|
[System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SetForegroundWindow")]
|
||||||
|
public static extern bool SetForegroundWindow(IntPtr hWnd); //设置此窗体为活动窗体
|
||||||
|
|
||||||
|
[System.Runtime.InteropServices.DllImport("User32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
|
||||||
|
public static extern int GetWindowThreadProcessId(IntPtr hwnd, out int ID);
|
||||||
//private void timer1_Tick(object sender, EventArgs e)
|
//private void timer1_Tick(object sender, EventArgs e)
|
||||||
//{
|
//{
|
||||||
// if (this.Handle != GetF()) //如果本窗口没有获得焦点
|
// if (this.Handle != GetF()) //如果本窗口没有获得焦点
|
||||||
@ -63,7 +74,6 @@ namespace HaoYue.BF3ChineseInput
|
|||||||
{
|
{
|
||||||
text1.Text += (char)e.KeyData;
|
text1.Text += (char)e.KeyData;
|
||||||
|
|
||||||
|
|
||||||
//判断按下的键(Alt + A)
|
//判断按下的键(Alt + A)
|
||||||
//if (e.KeyValue == (int)Keys.A && (int)System.Windows.Forms.Control.ModifierKeys == (int)Keys.Alt)
|
//if (e.KeyValue == (int)Keys.A && (int)System.Windows.Forms.Control.ModifierKeys == (int)Keys.Alt)
|
||||||
//{
|
//{
|
||||||
|
Loading…
Reference in New Issue
Block a user