Changing MenuBar items «on the fly»

Many OS X users are aware that they can get a bunch of whole new options in the MenuBar menu almost in any application if they hold the Option (Alt) key on the keyboard (a good example would be to open any App menu and hold Option - in most cases, you will see that «Quit» is changed to «Quit and keep windows»). I had recently googled about using Option key as such a way to modify the App content «on the fly» for window elements, and after reading some topics from old RealSoftware forum I was finally able to come up with a code which can do that. I have been also trying to use it for items in MenuBar, however I was able to change them only before I open the menu. As long as it is open, they don’t change. I keep calling EnableMenuItems from the timer repeatedly, but no success. Did someone engage to this before? Is there a solution to this?

EDIT: Cocoa framework.

[quote=28572:@Alex Qyoun-ae]Many OS X users are aware that they can get a bunch of whole new options in the MenuBar menu almost in any application if they hold the Option (Alt) key on the keyboard (a good example would be to open any App menu and hold Option - in most cases, you will see that «Quit» is changed to «Quit and keep windows»). I had recently googled about using Option key as such a way to modify the App content «on the fly» for window elements, and after reading some topics from old RealSoftware forum I was finally able to come up with a code which can do that. I have been also trying to use it for items in MenuBar, however I was able to change them only before I open the menu. As long as it is open, they don’t change. I keep calling EnableMenuItems from the timer repeatedly, but no success. Did someone engage to this before? Is there a solution to this?

EDIT: Cocoa framework.[/quote]

It’d be doable via a declare to setAlternate:, if only it was possible to get the handle of a MenuItem.