我正在尝试在 C# 中模拟按键,但出现以下错误:
Error 2 The name 'WM_KEYDOWN' does not exist in the current context c:\users\frk\documents\visual studio 2010\Projects\HaxBot3\HaxBot3\Form1.cs 28 52 HaxBot3
Error 5 The name 'WM_KEYDOWN' does not exist in the current context c:\users\frk\documents\visual studio 2010\Projects\HaxBot3\HaxBot3\Form1.cs 29 52 HaxBot3
Error 8 The name 'WM_KEYDOWN' does not exist in the current context c:\users\frk\documents\visual studio 2010\Projects\HaxBot3\HaxBot3\Form1.cs 30 52 HaxBot3
Error 9 The name 'VK_RIGHT' does not exist in the current context c:\users\frk\documents\visual studio 2010\Projects\HaxBot3\HaxBot3\Form1.cs 30 64 HaxBot3
Error 3 The name 'VK_CONTROL' does not exist in the current context c:\users\frk\documents\visual studio 2010\Projects\HaxBot3\HaxBot3\Form1.cs 28 64 HaxBot3
Error 6 The name 'VK_ALT' does not exist in the current context c:\users\frk\documents\visual studio 2010\Projects\HaxBot3\HaxBot3\Form1.cs 29 64 HaxBot3
Error 1 The name 'PostMessage' does not exist in the current context c:\users\frk\documents\visual studio 2010\Projects\HaxBot3\HaxBot3\Form1.cs 28 17 HaxBot3
Error 4 The name 'PostMessage' does not exist in the current context c:\users\frk\documents\visual studio 2010\Projects\HaxBot3\HaxBot3\Form1.cs 29 17 HaxBot3
Error 7 The name 'PostMessage' does not exist in the current context c:\users\frk\documents\visual studio 2010\Projects\HaxBot3\HaxBot3\Form1.cs 30 17 HaxBot3
这是给出错误的代码:
public static void Forward()
{
Process[] processes = Process.GetProcessesByName("test");
foreach (Process proc in processes)
{
PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_CONTROL, 0);
PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_ALT, 0);
PostMessage(proc.MainWindowHandle, WM_KEYDOWN, VK_RIGHT, 0);
}
}//Fprward
我想我必须添加一些东西using System.(something)
但是什么?感谢帮助。