• 大小: 113KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-06-10
  • 语言: C#
  • 标签: C#  

资源简介

全局的Hook,可以获取MouseMove,MouseClick,MouseDown Up,DoubClick. 滚轮,Press,键盘的KeyPress,keyDown,KeyUp

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Drawing;


namespace CsHook1 {
    class CsHook {
        //拖管对象
        public delegate int HookProc(int nCode IntPtr wParam IntPtr lParam);

        //[DllImport(“LowLevelHook.dll“)]
        //public extern static IntPtr SetHook(int hookType HookProc hookProc);

        //[DllImport(“LowLevelHook.dll“)]
        //public extern static bool UnHook(IntPtr hook);      

        [DllImport(“user32.dll“)]
        public static extern int CallNextHookEx(IntPtr hookHandle int nCode IntPtr wParam IntPtr lParam);

        [StructLayout(LayoutKind.Sequential)]
        public struct MSLLHOOKSTRUCT {
            public Point Point;
            public int MouseData;
            public int Flags;
            public int Time;
            public int ExtraInfo;
        }

        public enum HookTypes : int {
            WH_JOURNALRECORD = 0
            WH_JOURNALPLAYBACK = 1
            WH_KEYBOARD = 2
            WH_GETMESSAGE = 3
            WH_CALLWNDPROC = 4
            WH_CBT = 5
            WH_SYSMSGFILTER = 6
            WH_MOUSE = 7
            WH_HARDWARE = 8
            WH_DEBUG = 9
            WH_SHELL = 10
            WH_FOREGROUNDIDLE = 11
            WH_CALLWNDPROCRET = 12
            WH_KEYBOARD_LL = 13
            WH_MOUSE_LL = 14
        }



            [DllImport(“user32.dll“ CharSet = CharSet.Auto CallingConvention = CallingConvention.StdCall SetLastError = true)]
            public static extern int SetWindowsHookEx(int idHookHookProc lpfnIntPtr hModint dwThreadId);

            [DllImport(“user32.dll“ CharSet = CharSet.Auto CallingConvention = CallingConvention.StdCall SetLastError = true)]
            public static extern int UnhookWindowsHookEx(IntPtr idHook);

            [DllImport(“user32.dll“ CharSet = CharSet.Auto CallingConvention = CallingConvention.StdCall)]
            public static extern int CallNextHookEx(int idHookint nCodeint wParamIntPtr lParam);
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1434  2009-02-26 15:05  CsHook\CsHook.sln

    ..A..H.     19968  2009-02-26 15:05  CsHook\CsHook.suo

     文件      14848  2009-02-26 15:06  CsHook\CsHook1\bin\Debug\CsHook1.exe

     文件      28160  2009-02-26 15:06  CsHook\CsHook1\bin\Debug\CsHook1.pdb

     文件      14328  2009-02-26 15:06  CsHook\CsHook1\bin\Debug\CsHook1.vshost.exe

     文件        490  2007-07-21 01:33  CsHook\CsHook1\bin\Debug\CsHook1.vshost.exe.manifest

     文件      28672  2009-02-26 15:06  CsHook\CsHook1\bin\Debug\Gma.UserActivityMonitor.dll

     文件      42496  2009-02-26 15:06  CsHook\CsHook1\bin\Debug\Gma.UserActivityMonitor.pdb

     文件       2165  2009-02-26 14:57  CsHook\CsHook1\CsHook.cs

     文件       4065  2009-02-26 14:20  CsHook\CsHook1\CsHook1.csproj

     文件       5213  2009-02-26 14:57  CsHook\CsHook1\Form1.cs

     文件      11665  2009-02-26 14:56  CsHook\CsHook1\Form1.Designer.cs

     文件       6022  2009-02-26 14:56  CsHook\CsHook1\Form1.resx

     文件        686  2009-02-26 15:06  CsHook\CsHook1\obj\Debug\CsHook1.csproj.FileListAbsolute.txt

     文件        847  2009-02-26 15:06  CsHook\CsHook1\obj\Debug\CsHook1.csproj.GenerateResource.Cache

     文件      14848  2009-02-26 15:06  CsHook\CsHook1\obj\Debug\CsHook1.exe

     文件        180  2009-02-26 15:06  CsHook\CsHook1\obj\Debug\CsHook1.Form1.resources

     文件      28160  2009-02-26 15:06  CsHook\CsHook1\obj\Debug\CsHook1.pdb

     文件        180  2009-02-26 15:06  CsHook\CsHook1\obj\Debug\CsHook1.Properties.Resources.resources

     文件       3887  2009-02-26 15:06  CsHook\CsHook1\obj\Debug\ResolveAssemblyReference.cache

     文件        473  2009-02-26 13:50  CsHook\CsHook1\Program.cs

     文件       1354  2009-02-26 13:50  CsHook\CsHook1\Properties\AssemblyInfo.cs

     文件       2775  2009-02-26 13:50  CsHook\CsHook1\Properties\Resources.Designer.cs

     文件       5612  2009-02-26 13:50  CsHook\CsHook1\Properties\Resources.resx

     文件       1064  2009-02-26 13:50  CsHook\CsHook1\Properties\Settings.Designer.cs

     文件        249  2009-02-26 13:50  CsHook\CsHook1\Properties\Settings.settings

     文件       1272  2008-11-11 12:19  CsHook\Gma.UserActivityMonitor\AssemblyInfo.cs

     文件      28672  2009-02-26 15:06  CsHook\Gma.UserActivityMonitor\bin\Debug\Gma.UserActivityMonitor.dll

     文件      42496  2009-02-26 15:06  CsHook\Gma.UserActivityMonitor\bin\Debug\Gma.UserActivityMonitor.pdb

     文件      38227  2009-02-26 15:06  CsHook\Gma.UserActivityMonitor\bin\Debug\Gma.xml

............此处省略30个文件信息

评论

共有 条评论