If you have any version of MS Word on your system, you could use its application object.
alias capslock {
var %a = a $+ $ticks
.comopen %a word.application
if $comerr { return Error }
tokenize 32 $com(%a,capslock,2) $com(%a).result
.comclose %a
return $2
}
If that's not good for you (if you don't have Word), then you'll probably need a dll.