- GetWindowRect ( fgStructure.Window->Parent->Window.Handle, &winRect ) ;
- x -= winRect.left + GetSystemMetrics( SM_CXSIZEFRAME ) ;
- y -= winRect.top + GetSystemMetrics( SM_CYSIZEFRAME ) + GetSystemMetrics( SM_CYCAPTION ) ;
+ RECT winRect;
+ int x, y;
+
+ GetWindowRect( fgStructure.Window->Window.Handle, &winRect );
+ x = winRect.left;
+ y = winRect.top;
+
+ if ( fgStructure.Window->Parent == NULL )
+ {
+ /*
+ * Adjust the size of the window to allow for the size of the
+ * frame, if we are not a menu
+ */
+ if ( ! fgStructure.Window->IsMenu )
+ {
+ width += GetSystemMetrics( SM_CXSIZEFRAME ) * 2;
+ height += GetSystemMetrics( SM_CYSIZEFRAME ) * 2 +
+ GetSystemMetrics( SM_CYCAPTION );
+ }
+ }
+ else
+ {
+ GetWindowRect( fgStructure.Window->Parent->Window.Handle,
+ &winRect );
+ x -= winRect.left + GetSystemMetrics( SM_CXSIZEFRAME );
+ y -= winRect.top + GetSystemMetrics( SM_CYSIZEFRAME ) +
+ GetSystemMetrics( SM_CYCAPTION );
+ }
+
+ MoveWindow(
+ fgStructure.Window->Window.Handle,
+ x,
+ y,
+ width,
+ height,
+ TRUE
+ );