文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 高等教育 > 哲学 > C#勾子解决方案(使用时请先重命后缀CS)
侵权投诉

C#勾子解决方案(使用时请先重命后缀CS)

C#中色勾子控制键盘

n NativeMethods.CallNextHookEx(hookID, nCode, wParam, ref lParam);

}
#endregion

#region Event Handling
/// <summary>
/// Raises the KeyIntercepted event.
/// </summary>
/// <param name="e">An instance of KeyboardHookEventArgs</param>
public void OnKeyIntercepted(KeyboardHookEventArgs e)
{
if (KeyIntercepted != null)
KeyIntercepted(e);
}

/// <summary>
/// Delegate for KeyboardHook event handling.
/// </summary>
/// <param name="e">An instance of InterceptKeysEventArgs.</param>
public delegate void KeyboardHookEventHandler(KeyboardHookEventArgs e);

/// <summary>
/// Event arguments for the KeyboardHook class's KeyIntercepted event.
/// </summary>
public class KeyboardHookEventArgs : System.EventArgs
{

private string keyName;
private int keyCode;
private bool passThrough;

/// <summary>
/// The name of the key that was pressed.
/// </summary>
public string KeyName
{
get { return keyName; }
}

/// <summary>
/// The virtual key code of the key that was pressed.
/// </summary>
public int KeyCode
{
get { return keyCode; }
}

/// <summary>
/// True if this key combination was passed to other applications,
/// false if it was trapped.
/// </summary>
public bool PassThrough
{
get { return passThrough; }
}

public KeyboardHookEventArgs(int evtKeyCode, bool evtPassThrough)
{
keyName = ((Keys)evtKeyCode).ToString();
keyCode = evtKeyCode;
passThrough = evtPassThrough;
}

}

#endregion

#region IDisposable Members
/// <summary>
/// Releases the keyboard hook.
/// </summary>
public void Dispose()
{
NativeMethods.UnhookWindowsHookEx(hookID);
}
#endregion

#region Native methods

[ComVisibleAttribute(false),
System.Security.SuppressUnmanagedCodeSecurity()]
internal class NativeMethods
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr GetModuleHandle(string lpModuleName);

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr SetWindowsHookEx(int idHook,
HookHandlerDelegate lpfn, IntPtr hMod, uint dwThreadId);

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool UnhookWindowsHookEx(IntPtr hhk);

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode,
IntPtr wParam, ref KBDLLHOOKS

上一页第4页

你可能喜欢

热门文档

相关文档

  • C#开发常见的文件名后缀

    其中常见的文件名后缀及其功能如下: .sln:解决方案文件,为解决方案资源管理器....csproj:项目文件,创建应用程序所需的引用、数据连接、文件夹和文件的信息。 ....

  • 301重定向后出现后缀eurl解决方案

    301重定向后出现后缀eurl解决方案_互联网_IT/计算机_专业资料 暂无评价0人阅读0次下载举报文档 301重定向后出现后缀eurl解决方案_互联网_IT/计算机_专业资料。...

  • ASPNET中各个后缀名意思

    ASPNET中各个后缀名意思_计算机软件及应用_IT/计算机_专业资料。ASPNET中各个...2 3 4 .sln: .csproj: .aspx: 解决方案文件,为解决方案资源管理器提供显示...

  • c#5

    (.cs后缀的 文件),分别是Forml.cs、Forml.Designer...在解决方案资源管理器中,右击项目LoginApp,在弹出的... saveFileDialog1.InitialDirectory = "c:"; ...

  • 三恩信息技术网络考试系统(CS版)常见问题及解决方法

    三恩信息技术网络考试系统(CS版)常见问题及解决方法_计算机硬件及网络_IT/计算机_专业资料。三恩信息技术网络考试系统(C/S)常见问题及解决方法序号 1 问题现象 ...

  • cs参数

    cs参数。cs参数详解使用最真实的弹道--学会设置...禁用对玩家模型的光滑处理,从而提高fps (以上7个...想提高fps最好的办法就是买新电脑 ! 今日推荐 ...

  • 使用C#和BlockUI进行UG二次开发

    将 dlx 和 cs 文件保存到 application 文件夹下。...2.7 生成解决方案 3.MenuScript 的编写 3.1 在 ...新建 myTest.txt 的文本文件,然后修改后缀为 men,...

  • C#复习

    文件结构:各种文件的后缀名: ? ? ? ? ? ? ? ? ? ? .sln:解决方案文件,为解决方案资源管理器提供显示管理文件的图形接口所需的 信息。 .csproj:项目文件...

  • C#复习

    文件结构:各种文件的后缀名: ? ? ? ? ? ? ? ? ? ? .sln:解决方案文件,为解决方案资源管理器提供显示管理文件的图形接口所 需的信息。 .csproj:项目文件...

  • C#习题二

    扩展名是 A.cs ( B. csproj C. suo D. sln )2, 某文件的后缀是 cs,...错误打Ⅹ) 判断题 正确打 2 ( ( ( ( )1>一个解决方案可以由 C#项目和 ...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email