SetWindowPos changes context menu size
If a context menu is open in the program being resized/repositioned it's size and position are also changed, is there any way around this?
Popup menus operate their own modal message loops. Key-presses are handled by the menu. Mouse clicks either invoke menu items, navigate sub-menus, or close the menu.
In short, there's no way for the user to invoke a move or size of a window whilst a menu is running its modal message loop.
Because of this, the designers of the system don't care what happens to the menu in the scenario that you describe because there's no supported way for that scenario to occur. It's happening for you because, I guess, you have a timer that calls SetWindowPos on the window that owns the menu.
The way around this is for you not to move or size windows whilst they have popup menus open.