>My code does not have a loop. Here is a pseudo code how it is done in the MAIN.PRG:
> ...
Sure. That was just an idea where to search for problems; but it doesn't seem to apply in your case.
Another thing you might check is whether there is any possibility that RemoveMenuItem(...) (if it is indeed called like that) removes the wrong item.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)