Any other way beside this.... i mean some support from lang/compiler for getting this.
In fact I have scenario something like
I have existing menu and menu-items. Now I am putting all these menu-items on toolbar. Since when these menu-items was inside menu-item I get event ON_UPDATE_COMMAND_UI where I call a function and update menu-items states.
But now for toolbar I have to put function for checking state every time, variables(which are many in number and also gets modified at many state, for which I have no control).
Can anyone suggest me some good alternative, without changing the existing code, since it's very fragile.
How and when would I come to know that the state is changed? Even I can't use observer pattern, since i am working on some legacy code where these variables are public with many holes in it, so i can't capture these change event on these variables.
I was wondering if there is some support by lang/compiler, the way the watch variable do when we use visual studio debugger.