Sounds like a Direct Input problem.
I recommend installing the latest Direct X version to see if that solves the problem.
What kind of keyboard is it? If it uses special software to make it work, try uninstalling that software, it could be causing a conflict with Direct Input.
Hope that helps.
~Sol