The documentation for SetKeyboardState() correctly says that you cannot use this API to toggle the NUM LOCK, CAPS LOCK, and SCROLL LOCK keys.
You can use keybd_event() to toggle the NUM LOCK, CAPS LOCK, and SCROLL LOCK keys under Windows NT. The same technique works for toggling CAPS LOCK and SCROLL LOCK under Windows 95, but it will not work for NUM LOCK.
You can use keybd_event() to toggle the NUM LOCK, CAPS LOCK, and SCROLL LOCK keys under Windows NT. The same technique works for toggling CAPS LOCK and SCROLL LOCK under Windows 95, but it will not work for NUM LOCK.