Dear Neil Hodgson. you wrote:
>  - 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.

I agree with it, but it's simple to restruct function ReleaseMenu into 
Recursiveless one, for example 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);
        }
}

But the main idea is right. It's worth to think about it, isn't it?

Regards. Alexander Zenkov.

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to