This post was imported from an old blog archive, and predates the creation of AdamCaudill.com
I am thrilled!
I have done it!
I have completed the most useful program ever developed… at least if you are like me and hit Caps-Lock every couple minutes. I know, I had you all excited, but although this really isn’t that great, it was fun to hack together and at least I’ll use it. You can get the exe, sounds and code here. To exit it, just press & hold caps-lock & ctrl for a couple seconds. It’s really a very simple application, the core is in this code:
Private Sub MonitorCapsLock()
Dim blnLastWasTrue As Boolean
If CBool(GetKeyState(VK_CAPITAL)) = True Then
'caps-lock is on
If (CBool(GetAsyncKeyState(VK_LCONTROL)) = True) _
And (CBool(GetAsyncKeyState(VK_CAPITAL)) = True) Then
'control is down, time to exit
'play the alarm
If blnLastWasTrue = False Then
blnLastWasTrue = True
PlayWav(False, AppPath() & "Woman Screem.wav")
blnLastWasTrue = False
It all boils down to three APIs,
PlaySound to play the wav file. If you have any improvements or suggestions, let me know.