That was because there was an <Anchor> element there once... I simply didn't noticed.
I now need to find a message which is been send to the window when it loses its activated state... any ideas?
Gotcha! WM_ACTIVATE saved me!
I'll now work this thing out...
I'm happy to tell you all that I've managed to do it. The menu gets created when the window loads, hides and will be shown when the button is clicked. Then, the position is re-calculated and the menu pops up. When the menu is deactivated, it hides again.
Now, one last thing: can someone tell me if there's a function which calculates the bounding box of a text in a specified font, like PHP's imagettfbbox(). I'd like to use this to resize the menu to fit the messages inside.