How do you do this?

I want to position a popup subapp to the top left of the frame area.

I can position it to the X/Y of the window, but this doesn't take into account the menu and border thickness. As I recall, border thickness can differ depending on the windows theme, and the menu size certainly can (with the font size of the system). So it's not just a case of adding 3 for the border, 20 for the header, and 20 for the menu.

How do I do this?

I guess I could resize it at start and do a formula we use in accounting called the High/Low technique (to split variable amounts with fixed amounts), but is there a simpler way?