首页 > 代码库 > C语言按下键盘操作

C语言按下键盘操作

 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<windows.h> 4 /* 5     按下windows+E键,打开资源管理器 6 */ 7 void main() { 8     keybd_event(0x5b ,0, 0, 0);//按下windows键 9 10     keybd_event(E, 0, 0, 0);//按下E键11     keybd_event(E, 0, 2, 0);//松开E键12 13     keybd_event(0x5b ,0, 2, 0);//键盘松开14 15     Sleep(2000);16 17     keybd_event(0x12,0,0,0);//按下alt18     keybd_event(0x73, 0, 0, 0);//按下F419 20     keybd_event(0x12, 0, 2, 0);//松开alt21     keybd_event(0x73, 0, 2, 0);//松开F422 23     24 }

 

C语言按下键盘操作