Take a look at this post for the API for discovering whether caps lock is on or not: -
How can I find the state of NumLock, CapsLock and ScrollLock in .net?
See example for comment: -
AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnExit);
public void OnExit(object sender, EventArgs e)
{
// check and turn caps off if neccessary
}