模拟键盘的动作信号-"SendKeys示例"
涉及的核心类,参见 《模拟键盘的动作信号-"SendInput示例"》
核心方法
1 private void SendMsg() 2 { 3 IntPtr hWnd = DLL_Navigation.FindWindowA(null, "TS"); 4 5 if (hWnd == null) 6 { 7 Console.WriteLine("未找到指定程序窗体!"); 8 return; 9 } 10 11 DLL_Navigation.ShowWindow(hWnd, 1); 12 if(hWnd!=DLL_Navigation.GetForegroundWindow()) 13 { 14 DLL_Navigation.SetForegroundWindow(hWnd); 15 } 16 17 //使用SendKeys实现:ALT+T+Q 18 SendKeys.SendWait("%TQ"); 19 System.Threading.Thread.Sleep(1); 20 21 //使用SendKeys实现:ALT+C 22 SendKeys.SendWait("%C"); 23 }
相关网址:
虚拟按键代码:https://learn.microsoft.com/zh-cn/windows/win32/inputdev/virtual-key-codes

浙公网安备 33010602011771号