以编程方式启用滚动,大写和数字键 [英] enabling scroll, caps and num key programmatically

查看:87
本文介绍了以编程方式启用滚动,大写和数字键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我的朋友正在做一个项目,他在打开和关闭键盘灯时很难打开和关闭,

但是我可以设置lED的简单逻辑在Windows窗体中以编程方式按下这些键,

i想要以编程方式按滚动,大写和数字键,以便键盘上的LED将打开然后关闭,我不知道该怎么做,我是新手和学生。

提前感谢,

请帮助

:)

as my friend is doing a project, he is facing difficult in enabling the keyboard lights to on and off in a form,
but the simple logic which i get to set the lED on and off in a windows form is pressing the these keys programmatically,
i want to press scroll , caps and num keys programmatically so that LED on the keboard will be turn On and then off, i dont know how to do that, i am a newbie and a student.
thanks in advance,
please help
:)

推荐答案

请尝试以下链接

[ ] < a href =http://www.codeproject.com/Articles/26317/Read-and-Update-CAPS-or-NUM-Lock-Status-from-your>从您的应用程序中读取和更新CAPS或NUM锁定状态 [ ^ ]







伪造数字锁定,大写锁定和滚动锁定指示 [ ^ ]
Try the following link
[]Read and Update CAPS or NUM Lock Status from your Application[^]

or

Faking num lock, caps lock and scroll lock leds[^]


在您的课程顶部使用System.Runtime.InteropServices放置

At the top of your class put
using System.Runtime.InteropServices;
...
		[DllImport("user32.dll")]
		static extern void keybd_event(byte bVk, byte bScan, uint dwFlags,
		UIntPtr dwExtraInfo);
		const int KEYEVENTF_EXTENDEDKEY = 0x1;
		const int KEYEVENTF_KEYUP = 0x2;
		const int CAPSLOCK = 0x14;
		const int NUMLOCK = 0x90;
		const int SCROLLLOCK = 0x91;





然后使用它..



Then to use it ..

keybd_event(CAPSLOCK, 0x45, KEYEVENTF_EXTENDEDKEY, (UIntPtr)0);
keybd_event(CAPSLOCK, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,(UIntPtr)0);





我认为这个功能现在已被取代,所以你可能想做一些谷歌搜索和改进(我现在正在使用相当旧版本的Visual Studio。)



关键代码的完整列表位于

http://msdn.microsoft.com/en-gb/library /windows/desktop/dd375731(v=vs.85).aspx [ ^ ]


这篇关于以编程方式启用滚动,大写和数字键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆