Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » cleaning the message map Collapse All
Subject Author Date
Pierre MEDART Aug 16, 2007 - 3:46 AM

Hi

In our application we have to dynamically associate menu id with command (contextual menu).

The issue we face is that once a CmdID is associated with a function, it will remain.

Is there a way to clean this message map ?

Thanks

Technical Support Aug 17, 2007 - 10:54 AM

The command hander methods, which are based on ON_COMMAND message map entries, are static and generated at compile time only. You should not operate with message map entries dynamically. The dynamic range of commands should be handled/updated in an overridden OnCmdMsg() virtual method only. It may be difficult to handle all the possible commands in one OnCmdMsg() method of the main frame or dialog class. You can derive your classes responsible for handling dynamic commands from the CCmdTarget class. The main frame’s OnCmdMsg() method should detect which CCmdTarget-based object should handle/update each particular command and invoke its OnCmdMsg() method.