我的“键盘记录器”有问题。为什么在这段代码中我看到库“使用System.Windows.Forms;”
的问题它显示以下错误:
名称空间'System.Windows'中不存在类型或命名空间名称'Forms'(您是否缺少程序集引用?)
C:\ Users \ SoChi \ documents \ visual studio 2013 \ Projects \ WpfApplication8 \ WpfApplication8 \ MainWindow.xaml.cs 16 22 WpfApplication8
我不知道为什么。你能救我吗?
整个守则:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;
using System.Windows.Forms;
using System.Drawing;
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace WpfApplication8
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern Int16 GetAsyncKeyState(int vKey);
private void Button_Click(object sender, RoutedEventArgs e)
{
while (true)
for (int key = 0; key < 255;key++)
if (GetAsyncKeyState(key) == -32767)
{
label.Content = "kliknales cos na klawiaturze";
}
}
}
} `