Re: GetClientRect() AND ShowWindow(SW_SHOWMAXIMIZED) in SDI app.



You have not specified if you are talking about "screen" or "window". If you want it to
fill the entire physical screen, you want to maximize the app, so that's automatic, and
that's what you've done. But maximizing the app only maximizes the main window. It does
not maximize the view. It maximizes the view frame, but not the view.
joe

On Tue, 28 Aug 2007 09:22:12 -0700, RAN <nijenhuis@xxxxxxx> wrote:

On Aug 28, 6:07 pm, Joseph M. Newcomer <newco...@xxxxxxxxxxxx> wrote:
See below...

On Tue, 28 Aug 2007 07:24:32 -0700, RAN <nijenh...@xxxxxxx> wrote:
Hi,

I have a SDI app.

1) In CWinApp::InitInstance() i do:
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);

2) In CFormView::OnInitialUpdate() i do:
CRect o_Rect;
GetClientRect(o_Rect);

****
This gets the client rectangle of the dialog.
****> o_BookList.MoveWindow (o_Rect,TRUE);

****
This should fill the client area, but not the entire screen. And this should not compile
at all, since it should have been
o_BookList.MoveWindow(&o_Rect);

note that the default for the second argument is TRUE so you don't have to supply it.

And I presume you really mean the class is CMyFormView::OnInitialUpdate, not
CFormView::OnInitialUpdate
****

o_BookList is a CListCtrl.

The listctrl is not the size of the entire screen which is what i was
trying to do. How do i get the listctrl to be displayed over the full
size of the screen ?

****
Note that the window is set to the size of the client area *at the time OnInitialUpdate is
called*. So what you would want to do here is set a breakpoint and see how big the area
is when you call that.

The correct place to do this is in an OnSIze handler:

void CMyFormView::OnSize(UINT type, int cx, int cy)
{
CFormView::OnSize(type, cx, cy);
if(o_BookList.GetSafeHwnd() != NULL)
{
o_BookList.SetWindowPos(NULL, 0, 0, cx, cy,
SWP_NOZORDER);
}
}

This is more likely to do what you want. Note that this will also follow the resizing of
the dialog, whereas your approach only sets it once.

Oh yes, this deals with the size of your dialog, not the actual size of the view. If you
need to resize the dialog to track the size of the view frame, you will need to add an
OnSize handler to your frame and resize the dialog as well, then the code above will only
resize the list control to the size of the dialog, but not resize the dialog to fill the
view frame.
joe



Joseph M. Newcomer [MVP]
email: newco...@xxxxxxxxxxxx
Web:http://www.flounder.com
MVP Tips:http://www.flounder.com/mvp_tips.htm

Ok thanks, but how do i get the absolute dimensions of every display
setting ?
Im mean how many pixels (units??) for x and y direction of the
screen ?
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Gray items in menus?
    ... in some really exotic situations. ... >> document, the view, the main frame, or the app (there are a few other ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: GetClientRect() AND ShowWindow(SW_SHOWMAXIMIZED) in SDI app.
    ... This should fill the client area, ... OnSize handler to your frame and resize the dialog as well, then the code above will only ... MVP Tips:http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: Gray items in menus?
    ... > document, the view, the main frame, or the app (there are a few other ... command routing allows you to ... Ajay Kalra [MVP - VC++] ...
    (microsoft.public.vc.mfc)
  • Re: GradFrame bombing VB6?
    ... anything like that in that frame control so, if you can give me some details that may help me ... I didn't remember where I got the reference to the web site, ... happens with the one app. ... I just opened the bad code again, closed it, and it didn't bomb. ...
    (microsoft.public.vb.controls)
  • wxPython Conventions
    ... I've recently decided to try my hand at GUI programming with wxPython, ... So I'm wondering if I should still use a Frame ... I'm admittedly unfamiliar with what would be considered proper. ... Would it be better to put them in my App ...
    (comp.lang.python)