Resizing a window



Okay, the View classes are great, but I'm having one hell-uv-a-time
trying to get something to work properly that I *need* to work
properly. :-)

After the window is created and displayed, I need to adjust the size of
it, because the size is wrong when first displayed. In C, this would be
done like so:

RECT cr;
DWORD style, styleEx;

GetClientRect(hWnd, &cr);

style = GetWindowLong(hWnd, GWL_STYLE);
styleEx = GetWindowLong(hWnd, GWL_EXSTYLE);

AdjustWindowRectEx(&cr, style, FALSE, styleEx);

Now 'cr' contains the *real* desired size of the window. Originally, if
I specify the window should be 800x600, when it's created, that
includes all the "fluff" as well - frame, menubar (if there is one),
etc. We adjust the rectangle to compensate for this and then resize the
window so that the actual "viewport" area is proper:

int width = cr.right - cr.left + 1;
int height = cr.bottom - cr.top + 1;

SetWindowPos(hWnd, NULL, 0, 0, width, height, SWP_NOMOVE |
SWP_NOZOREDER);

Phew. Too much C. Now, I can do all of this with the UserLibrary and
all the code works, except that the SetWindowPos doesn't actually seem
to do anything. I do all of this in #onViewCreated, which could
possibly be the problem (I actually don't know the order of events in
Dolphin - in C I would do this right before ShowWindow). I've tried
using #width: and #height:, but none of these appear to actually work.

I can confirm 100% that the view is not the correct size, because
rendering a square in the viewport is not a *real* square (note: this
is rendering with Direct3D, not GDI which deals with pixels and not
projections).

Any helpful hints appreciated. Thanks!

Jeff M.

.



Relevant Pages

  • Cannot use System Restore - Blank screen
    ... Whenever I start System Restore now, it will show the window at the proper ... I wasn't able to test if my IE theory is correct, because I can't reinstall ...
    (microsoft.public.windowsxp.help_and_support)
  • RE: NetScreen XP and NetMeeting
    ... >shocked to the see the internal IP of the internal PC in this window. ... >could NetScreen running NAT allow an internal ip "escape" into ... rewrite the packet completely and allow for proper communication. ...
    (Security-Basics)
  • Re: Race free attributes in sysfs
    ... I'm reworking the sysfs stuff in the MMC layer to be a bit more flexible, ... /sys but doesn't have the proper attributes. ... annoying if it has to add artificial delays to avoid this window. ...
    (Linux-Kernel)
  • Re: mis-aligned full screen views in OE
    ... Open one "mis-aligned" window and minimize all others. ... "Alan" wrote in message ... > to the right (as in a cascading display), it would at least be usable. ... > Since the proper left edge of the new window is off the display to the ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)