你的灯还亮着吗

yyfly 2005-04-21 12:57:24
请问我怎么通过程序来点亮键盘的三个灯
用什么语言实现都没所谓.
不要用模拟键盘按键的方法.
最好是灯的亮灭不影响键盘状态.
...全文
127 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
rushinger 2005-04-21
  • 打赏
  • 举报
回复
给楼主鼓鼓劲,我见过用键盘灯显示网络流量的小玩意
vcmute 2005-04-21
  • 打赏
  • 举报
回复
原理先设中断9处理函数
然后往0x60端口输出ED和1-7
LEDS: write_kbd(0x60, 0xED); /* "set LEDs" command */
temp = 0;
if(kbd_status & KBD_META_SCRL)
temp |= 1;
if(kbd_status & KBD_META_NUM)
temp |= 2;
if(kbd_status & KBD_META_CAPS)
temp |= 4;
write_kbd(0x60, temp); /* bottom 3 bits set LEDs */

P.S。和以前写汇编有点相似
vcmute 2005-04-21
  • 打赏
  • 举报
回复
http://my.execpc.com/~geezer/osd/kbd/kbd.c
可惜这个只有Turbo C, DJGPP, Watcom C版
pomelowu 2005-04-21
  • 打赏
  • 举报
回复
There's really nothing fancy about this code, it creates a DOS device for the keyboard device, opens a handle to that device, and calls DeviceIoControl to send IOCTL function codes to the device.

It did require a fair amount digging around in the DDK to create this effect, and it is an interesting twist on an alternate UI mechanism, and thus I felt it might be suitable for inclusion in this archive.


这个是从驱动入手的,应该就是楼主想要的东西了。
an_bachelor 2005-04-21
  • 打赏
  • 举报
回复
他说了不想合成键盘消息……
pomelowu 2005-04-21
  • 打赏
  • 举报
回复
http://codeguru.earthweb.com/Cpp/W-P/system/keyboard/article.php/c2825/
老夏Max 2005-04-21
  • 打赏
  • 举报
回复
参考:http://dev.csdn.net/Develop/article/33/33986.shtm
老夏Max 2005-04-21
  • 打赏
  • 举报
回复
最好是灯的亮灭不影响键盘状态.
===============
呵呵,比较难吧!其他的可以参考:
void CDialogTestDlg::OnButton14()
{
// TODO: Add your control notification handler code here
bool bState=true; //true为按下NumLock,false反之
BYTE keyState[256];

GetKeyboardState((LPBYTE)&keyState);
if( (bState && !(keyState[VK_NUMLOCK] & 1)) ||
(!bState && (keyState[VK_NUMLOCK] & 1)) )
{
// Simulate a key press
keybd_event( VK_NUMLOCK,
0x45,
KEYEVENTF_EXTENDEDKEY | 0,
0 );

// Simulate a key release
keybd_event( VK_NUMLOCK,
0x45,
KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
}

}
Trashy 2005-04-21
  • 打赏
  • 举报
回复
鼓励一下~
uoyevoli 2005-04-21
  • 打赏
  • 举报
回复
哇,自己写个键盘驱动:)

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧