惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
T
Tailwind CSS Blog
Hugging Face - Blog
Hugging Face - Blog
Blog — PlanetScale
Blog — PlanetScale
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
U
Unit 42
I
InfoQ
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
B
Blog RSS Feed
Vercel News
Vercel News
F
Fortinet All Blogs
Know Your Adversary
Know Your Adversary
T
Troy Hunt's Blog
博客园 - 【当耐特】
MongoDB | Blog
MongoDB | Blog
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
Jina AI
Jina AI
小众软件
小众软件
T
Threatpost
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
The Hacker News
The Hacker News
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
酷 壳 – CoolShell
酷 壳 – CoolShell
Scott Helme
Scott Helme
B
Blog
腾讯CDC
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
S
Schneier on Security
N
News and Events Feed by Topic
Microsoft Security Blog
Microsoft Security Blog
K
Kaspersky official blog
G
Google Developers Blog
T
Tor Project blog
PCI Perspectives
PCI Perspectives
S
Secure Thoughts
Google Online Security Blog
Google Online Security Blog
Latest news
Latest news
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
罗磊的独立博客

博客园 - 感觉De味道

CRC16_Check 源代码类修改版 HI baidu~~~~~~开通了~~~ [转] js 选时间的控件 - 感觉De味道 自我复制的简单实现(C#) 使用C#调用外部命令 - 感觉De味道 - 博客园 VS2005 中比较有用的快捷键 C#让windows程序只运行一次 [转] - 感觉De味道 - 博客园 只允许一个进程运行的实例 网址大全[收集网上大部份好的开源网] C#模拟MSN窗体抖动 javascript 常用小技巧 - 感觉De味道 - 博客园 衔接UI线程和管理后台工作线程的类(多线程、异步调用)[转] 关于线程问题 [转] 扫雷高手版出台 (本站原创) 写了一个操作XML文件的类 类型转换(本站原创) 一个简单的C#托盘程序(本站原创) 232串口通信程序刚完成(本站原创) 木马代码
用C#捕捉键盘和鼠标
感觉De味道 · 2007-06-05 · via 博客园 - 感觉De味道

用C#捕捉键盘和鼠标
直接把下面代码copy到VS05编译器中运行.
using System ;
using System.Drawing ;
using System.Collections ;
using System.ComponentModel ;
using System.Windows.Forms ;
using System.Data ;
public class Form1 : Form
{
    private Label label1;
    private System.ComponentModel.Container components = null;

    public Form1()
    {
       //初始化窗体中的各个组件
        InitializeComponent();
    }
    protected override void Dispose(bool disposing)
    {
      //清除程序中使用过的资源
        if (disposing)
        {
            if (components != null)
            {
                components.

                    Dispose();
            }
        }
        base.Dispose(disposing);
    }
    private void InitializeComponent()
    {
        this.label1 = new System.Windows.Forms.Label();
        this.SuspendLayout();
        //
        // label1
        //
        this.label1.AutoSize = true;
        this.label1.Location = new System.Drawing.Point(145, 71);
        this.label1.Name = "label1";
        this.label1.Size = new System.Drawing.Size(119, 12);
        this.label1.TabIndex = 0;
        this.label1.Text = "按回车建.可直接退出";
        //
        // Form1
        //
        this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
        this.ClientSize = new System.Drawing.Size(565, 273);
        this.Controls.Add(this.label1);
        this.KeyPreview = true;
        this.Name = "Form1";
        this.Text = "C#捕捉键盘和鼠标 By感觉De味道";
        this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyUp);
        this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
        this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseDown);
        this.Load += new System.EventHandler(this.Form1_Load);
        this.ResumeLayout(false);
        this.PerformLayout();

    }
    //程序开始.
    static void Main()
    {
        Application.Run(new Form1());
    }

    private void Form1_KeyUp(object sender, KeyEventArgs e)
    {
        MessageBox.Show(e.KeyCode.ToString(), "您所按动的健为:");

        switch (e.KeyCode)
        {
            case Keys.A: System.Diagnostics.Process.Start(@"D:\StormII\Storm.exe"); break;
             
            case Keys.Enter: this.Close(); break;//回车退出程序.

          //  default: MessageBox.Show("BEY"); break;
        }
    }

    private void Form1_Load(object sender, EventArgs e)
    {
       
    }

private void Form1_MouseDown ( object sender , MouseEventArgs e )
{

if ( e.Button == MouseButtons.Left )
{
MessageBox.Show ( "按动鼠标左键!" ) ;
}
if ( e.Button == MouseButtons.Middle )
{
MessageBox.Show ( "按动鼠标中键!") ;
}
if ( e.Button == MouseButtons.Right )
{
MessageBox.Show ( "按动鼠标右键!") ;
}
}
//获取当前鼠标的位置.
    private void Form1_MouseMove(object sender, MouseEventArgs e)
    {
        this.Text = "当前鼠标的位置为:( " + e.X + " , " + e.Y + ") By感觉De味道";
    }

    private void button1_Click_1(object sender, EventArgs e)
    {

    }

}