Confused for adding message handler for runtime created static controls?
Posted on 2004-04-26
I have a 10 runtime create static controls with resource ID; like 100, 101, 102, 103, 104,105,106
107,108,109. I want to have a function to do something for each control when the control is clicked with mouse left button down. What I have done is to add this line to MESSAGE_MAP
ON_COMMAND_RANGE(100, 109, OnClick)and add afx_msg void OnClick(UINT nID) to header file.
The one thing that I am little confused about it is how ON_COMMAND_RANGE knows only
to work when left button is clicked which is exactly what I want! why not work when
RBUTTONDOWN, or MOUSEMOVE, or LBUTTONUP..............................
Even ON_COMMAND_RANGE(100, 109, OnClick) works for me, is it correct to use it?
If not , what is correct message that I should use.