如何确定已经按下了capslock numlock insert scrolock,并确定当前状态1 怎么没人理我请诸位帮帮忙吧 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 调用API GetKeyStateDeclare this class first: [ ComVisibleAttribute(false), SuppressUnmanagedCodeSecurityAttribute() ] internal class NativeMethods { [DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true, CallingConvention=CallingConvention.Winapi)] public static extern short GetKeyState(int keyCode); public static int HIWORD(int n) { return ((n >> 16) & 0xffff/*=~0x0000*/); } public static int LOWORD(int n) { return (n & 0xffff/*=~0x0000*/); } } Then when you want to check if Caps is down or ON, call: short state = NativeMethods.GetKeyState(0x14 /*VK_CAPTIAL*/); bool capsKeyDown = NativeMethods.HIWORD(state); bool capsKeyON = NativeMethods.LOWORD(state); 楼上的,你可以我同意你的方法,请楼主试试 DataGridView的单元格坐标 c#Stroke.Add(e.X,e.Y) (高分求助)Remoting三层架构和普通C/S架构区别? 这个下拉框绑定怎么报错? #标题党#请问关于WebService的一些问题! 除了System.Windows.Forms.Application.StartupPath之外还有哪几种方法可以获得应用程序路径? 寻求截断字符串更优方法 数据访问的问题? 哪位大侠知道msn的插件是怎么作的,或者相关的资料连接,谢了 怎么检测是否已经安装了svg3.0 如何让TreeView 启动时不会自动选中一个节点??? 简体<--->繁体,如何实现?
[
ComVisibleAttribute(false),
SuppressUnmanagedCodeSecurityAttribute()
]
internal class NativeMethods
{
[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true, CallingConvention=CallingConvention.Winapi)]
public static extern short GetKeyState(int keyCode);
public static int HIWORD(int n)
{
return ((n >> 16) & 0xffff/*=~0x0000*/);
}
public static int LOWORD(int n)
{
return (n & 0xffff/*=~0x0000*/);
}
}
Then when you want to check if Caps is down or ON, call:
short state = NativeMethods.GetKeyState(0x14 /*VK_CAPTIAL*/);
bool capsKeyDown = NativeMethods.HIWORD(state);
bool capsKeyON = NativeMethods.LOWORD(state);
我同意你的方法,请楼主试试