Especially when running on a 64-bit system you may run into problems. To ensure your application works on 32-bit and 64-bit you have to make some small changes to the API declaration.
To make something clear: Even though it says “user32.dll” it is actually a dll with 64-bit functions. The 32-bit version of it is in the WOW64 folder.
This is the code I am using: