Re: Calculating the client area

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Yes, for some reason my mainframe window is getting created a little bit
bigger than the real client area. At first I thought it was big enough to
also hold the bottom menu/toolbar but its not quite that large. For example,
on a HiRes PPC device, the main frame window gets sized as 560 (or so)x480.
The real client area is 536x480. If I then put the SIP up and then down, it
will get properly resized.

Perhaps this is a MFC bug (I'm using VS 2005 b2). I traced through the code
and it appeared that MFC was creating the initial window with default values
(for the OS to size it properly) so I didn't think MFC would be the problem.
Perhaps I misread the code. I'll go back and look at that.

I don't recall exactly why but there've been numerous times where I'd like
to create a new window and want to resize it to fill the client area of the
device. It would be nice to somehow have a reliable way of calculating this.
That's basically what I'm looking for.

Thanks!
//Ray

"r_z_aret@xxxxxxxxxxxx" wrote:

> On Tue, 20 Sep 2005 12:24:11 -0700, Ray Marshall
> <RayMarshall@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> >One of my biggest frustrations with WinCE programming is calculating the
> >client area for my app. This is the area in between the menu bar at the top
> >and the menu/toolbar at the bottom.
> >
> >I'm currently using GetClientRect for my main frame window. Unfortunately,
> >when my app first starts up, the size of the window is a bit larger than this
>
> Size of _which_ window? The client area or the full window, or ...?
>
> >area. Later, when the user switches to landscape or something, I get a
> >WM_SIZE event and now the window is properly sized. This causes all sorts of
> >frustrations.
>
> Are you saying that the initial size of the full window, and thus the
> client area, is bigger than after the first WM_SIZE message?
>
> I have code that sizes and positions my controls dynamically. Whenever
> I need to paint a window, I use GetClientRect to get the current
> dimensions of the client area and use that to determine the sizes and
> locations of all the controls. I've never noticed any problems.
>
> If you're having trouble determining the initial size of the _whole_
> window, that is a slightly different question. For Pocket PCs,
> straight C/C++, SHFullScreen is the most relevant function. For a more
> general approach, see my 19 June 2003 contribution to a thread called
> "Fullscreen" in comp.os.ms-windows.programmer.win32.
>
> >
> >Therefore, what's the best way to calculate this area? I'd like to use
> >GetSystemMetrics but there isn't a define for the complete size of the top
> >and bottom bars.
> >
> >Thanks,
> >//Ray
>
> -----------------------------------------
> To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
>
> Robert E. Zaret, eMVP
> PenFact, Inc.
> 500 Harrison Ave., Suite 3R
> Boston, MA 02118
> www.penfact.com
>
.



Relevant Pages

  • Re: Calculating the client area
    ... >bigger than the real client area. ... >and it appeared that MFC was creating the initial window with default values ... is bigger than after the first WM_SIZE message? ...
    (microsoft.public.pocketpc.developer)
  • Re: translucent client area with WS_EX_LAYERED
    ... copy the actual window content to a 32bpp DIBSECTION. ... BitBlt in the exact location of the client area your pARGB bitmap ... UpdateLayeredWindow with the bitmap from the previous steps. ... but to the frame of the window. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: CScrollView in mdi
    ... I wanna show a CScrollView wondow, but sometimes the shown window may be ... bigger the the client area, so what I need to do is to set the window size ... and add scrolling so the user may be able to view all ...
    (microsoft.public.vc.mfc)
  • Re: Location information of MDI child forms
    ... position of the top most window should be the top offset. ... MDI Children. ... This works fine as long as the user does not scroll ... When the user scrolls the client area I am storing wrong locations, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: translucent client area with WS_EX_LAYERED
    ... copy the actual window content to a 32bpp DIBSECTION. ... forcefully set Alpha=0xFF for the window-rect minus the client area. ... UpdateLayeredWindow with the bitmap from the previous steps. ... I don't really want to mix per-pixel alpha and GDI. ...
    (microsoft.public.win32.programmer.gdi)