C#中色勾子控制键盘
ativeMethods.GetKeyState(VK_CAPITAL) & 0x0001) != 0)
{
//CAPSLOCK is ON
sb.AppendLine("Capslock is enabled.");
}
if ((NativeMethods.GetKeyState(VK_SHIFT) & 0x8000) != 0)
{
//SHIFT is pressed
sb.AppendLine("Shift is pressed.");
}
if ((NativeMethods.GetKeyState(VK_CONTROL) & 0x8000) != 0)
{
//CONTROL is pressed
sb.AppendLine("Control is pressed.");
}
if ((NativeMethods.GetKeyState(VK_MENU) & 0x8000) != 0)
{
//ALT is pressed
sb.AppendLine("Alt is pressed.");
}
Console.WriteLine(sb.ToString());
}
#endregion Check Modifier keys
#region Hook Callback Method
/// <summary>
/// Processes the key event captured by the hook.
/// </summary>
private IntPtr HookCallback(
int nCode, IntPtr wParam, ref KBDLLHOOKSTRUCT lParam)
{
bool AllowKey = PassAllKeysToNextApp;
//Filter wParam for KeyUp events only
if (nCode >= 0)
{
if (wParam == (IntPtr)WM_KEYUP || wParam == (IntPtr)WM_SYSKEYUP)
{
// Check for modifier keys, but only if the key being
// currently processed isn't a modifier key (in other
// words, CheckModifiers will only run if Ctrl, Shift,
// CapsLock or Alt are active at the same time as
// another key)
if (!(lParam.vkCode >= 160 && lParam.vkCode <= 164))
{
CheckModifiers();
}
// Check for key combinations that are allowed to
// get through to Windows
//
// Ctrl+Esc or Windows key
if (AllowWindowsKey)
{
switch (lParam.flags)
{
//Ctrl+Esc
case 0:
if (lParam.vkCode == 27)
AllowKey = true;
break;
//Windows keys
case 1:
if ((lParam.vkCode == 91) || (lParam.vkCode == 92))
AllowKey = true;
break;
}
}
// Alt+Tab
if (AllowAltTab)
{
if ((lParam.flags == 32) && (lParam.vkCode == 9))
AllowKey = true;
}
OnKeyIntercepted(new KeyboardHookEventArgs(lParam.vkCode, AllowKey));
}
//If this key is being suppressed, return a dummy value
if (AllowKey == false)
return (System.IntPtr)1;
}
//Pass key to next application
retur
其中常见的文件名后缀及其功能如下: .sln:解决方案文件,为解决方案资源管理器....csproj:项目文件,创建应用程序所需的引用、数据连接、文件夹和文件的信息。 ....
301重定向后出现后缀eurl解决方案_互联网_IT/计算机_专业资料 暂无评价0人阅读0次下载举报文档 301重定向后出现后缀eurl解决方案_互联网_IT/计算机_专业资料。...
ASPNET中各个后缀名意思_计算机软件及应用_IT/计算机_专业资料。ASPNET中各个...2 3 4 .sln: .csproj: .aspx: 解决方案文件,为解决方案资源管理器提供显示...
(.cs后缀的 文件),分别是Forml.cs、Forml.Designer...在解决方案资源管理器中,右击项目LoginApp,在弹出的... saveFileDialog1.InitialDirectory = "c:"; ...
三恩信息技术网络考试系统(CS版)常见问题及解决方法_计算机硬件及网络_IT/计算机_专业资料。三恩信息技术网络考试系统(C/S)常见问题及解决方法序号 1 问题现象 ...
cs参数。cs参数详解使用最真实的弹道--学会设置...禁用对玩家模型的光滑处理,从而提高fps (以上7个...想提高fps最好的办法就是买新电脑 ! 今日推荐 ...
将 dlx 和 cs 文件保存到 application 文件夹下。...2.7 生成解决方案 3.MenuScript 的编写 3.1 在 ...新建 myTest.txt 的文本文件,然后修改后缀为 men,...
文件结构:各种文件的后缀名: ? ? ? ? ? ? ? ? ? ? .sln:解决方案文件,为解决方案资源管理器提供显示管理文件的图形接口所需的 信息。 .csproj:项目文件...
文件结构:各种文件的后缀名: ? ? ? ? ? ? ? ? ? ? .sln:解决方案文件,为解决方案资源管理器提供显示管理文件的图形接口所 需的信息。 .csproj:项目文件...
扩展名是 A.cs ( B. csproj C. suo D. sln )2, 某文件的后缀是 cs,...错误打Ⅹ) 判断题 正确打 2 ( ( ( ( )1>一个解决方案可以由 C#项目和 ...
热门文档