Created
May 7, 2014 01:58
-
-
Save misodengaku/38c0b68dfb4e9af5f822 to your computer and use it in GitHub Desktop.
CapsLock死ね
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://msdn.microsoft.com/ja-jp/library/cc364822.aspx | |
| #include <windows.h> | |
| void SetCapsLock( BOOL bState ) | |
| { | |
| BYTE keyState[256]; | |
| GetKeyboardState((LPBYTE)&keyState); | |
| if( (bState && !(keyState[VK_CAPITAL] & 1)) || | |
| (!bState && (keyState[VK_CAPITAL] & 1)) ) | |
| { | |
| // キーの押し下げをシミュレートする。 | |
| keybd_event( VK_CAPITAL, | |
| 0x45, | |
| KEYEVENTF_EXTENDEDKEY | 0, | |
| 0 ); | |
| // キーの解放をシミュレートする。 | |
| keybd_event( VK_CAPITAL, | |
| 0x45, | |
| KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, | |
| 0); | |
| } | |
| } | |
| void main() | |
| { | |
| SetCapsLock( FALSE ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
まじ死んで欲しいですよね