Command ID Conflict

I am trying to create dynamically some menu and controls. I am assigning some arbitrary number as a command id.
How Can I ensure my command Id is unique?
In OnCmdMsg I have found my function is called even though I haven't initiated my menu. It might be same ID is used by other objet.

menu->AppendMenu(MF_STRING,2,"ShowDetail");// here 2 is command id

Thank you
[398 byte] By [s196675m] at [2007-11-20 11:27:45]
# 1 Re: Command ID Conflict
User IDs must start counting from WM_USER.

menu->AppendMenu(MF_STRING, WM_USER + 2, "ShowDetail");
Skizmo at 2007-11-10 22:25:27 >