Neil Hodgson <nyamatongwe <at> gmail.com> writes:
>
> mozers:
>
> > - cascading menu Tools, recording and playing macro
>
> The _MAX_EXTENSION_RECURSIVE_CALL stuff looks like a bandage on a
> systemic problem and I really don't trust it.
>
Dear Neil Hodgson. I'm completely agree with you about RECURSIVE_CALL, but it
simple to transfere them into RECURSIVELESS function. For example it's possible
to write like that:
void NewReleaseMenu(HMENU hMenu) {
int ptr = 0, to_check = 0;
struct UserMenu {
HMENU hMenu;
} UMenu[100];
UMenu[ptr++].hMenu = hMenu;
//~ Fill the struct with pointers that must be released
do {
for (int i = 0; i < ::GetMenuItemCount(UMenu[to_check].hMenu); i++)
UMenu[ptr++].hMenu = ::GetSubMenu(UMenu[to_check].hMenu, i);
to_check++; //~ We've just finished checked this menu, let's move to the
next one. If there isn't any more to_check will approach to ptr.
} while (to_check<=ptr);
//~ In descending order destroy all the menus
for (int i = ptr-1; i >= 0; i--) {
::DestroyMenu(UMenu[i].hMenu);
}
}
It is example only, but working example.
On my opinion the Tools menu grows too fast and it's worth to pay attention by
organizing it. Only ReleaseMenu functions are recursive, and it's possible to
rewrite it as you want.
Sincerelly yours. Alexander Zenkov.
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest