I've been trying for the past few hours to try and find out how to handle a button click event when I create a button using CreateWindowEx.

I've managed to make it so that it detects clicks on buttons, but how can I find out what button it is? That's the bit I've been stuck on and it's becomming very annoying, and the MSDN help is useless on the subject!