You're quite right -- you can't really use BM_CLICK or any other #define at run-time unless you refer to it directly, because a #define is just a text substitution as far as the compiler is concerned (i.e., it happens at compile time, and any knowledge about the #define is lost). I've used a table and a lookup function to map the input text ("BM_CLICK") to the corresponding value; it's not particularly elegant, but it solves the problem.
Hope this helps.
Hope this helps.