I have seen some nice one-line functions for toggling Caps Lock on/off, maybe here: http://www.cprogramming.com/source/caps.zip