CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    May 2001
    Posts
    2

    Client Maximizing

    I need to maximize my client window,
    i used the ShowWindow function
    inside the CWnd::OnCreate to maximize
    the frame window, but still there is to maximize
    the client one.

    thanks
    Sindrom11


  2. #2
    Join Date
    Feb 2001
    Location
    Sydney, Australia
    Posts
    1,909

    Re: Client Maximizing

    Hi Sindrom11,

    Try to find in your sources code like that:
    m_pMainWnd->ShowWindow(SW_SHOW);
    and replace line found with the next line
    m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);



    Best regards,

    -----------
    Igor Soukhov (Brainbench/Tekmetrics ID:50759)
    igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
    Best regards,
    Igor Sukhov

    www.sukhov.net

  3. #3
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: Client Maximizing

    Even I have the mainframe window maximizing issue.

    My mainframe window not opening in fully MAXIMIZED mode when I run my application
    ( Note: It is a single child mainframe application ).

    I am calling this below line of code in my OnCreate function

    Code:
       this->ShowWindow(SW_SHOWMAXIMIZED);
    but still the window opens in less width and height and it is not occupying the entire screen.

    Any changes to be done in the code?

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Client Maximizing

    Quote Originally Posted by vcdebugger View Post
    Even I have the mainframe window maximizing issue.

    My mainframe window not opening in fully MAXIMIZED mode when I run my application
    ( Note: It is a single child mainframe application ).

    I am calling this below line of code in my OnCreate function

    Code:
       this->ShowWindow(SW_SHOWMAXIMIZED);
    but still the window opens in less width and height and it is not occupying the entire screen.

    Any changes to be done in the code?
    Have a look at your app class InitInstance method. Somewhere near the end of this method should be the lines like
    Code:
    	m_pMainWnd->ShowWindow(SW_SHOW);
    	m_pMainWnd->UpdateWindow();
    	return TRUE;
    Replace the
    Code:
    m_pMainWnd->ShowWindow(SW_SHOW);
    with
    Code:
    m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
    Victor Nijegorodov

  5. #5
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: Client Maximizing

    Thanks. Its working now.

    I want my window size to be fixed and dont want to allow user to resized by streching the window frame. Any idea how to do it...
    Last edited by vcdebugger; August 18th, 2020 at 06:47 AM.

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Client Maximizing

    Quote Originally Posted by vcdebugger View Post
    Thanks. Its working now.

    I want my window size to be fixed and dont want to allow user to resized by streching the window frame. Any idea how to do it...
    Code:
    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    	cs.style &= ~WS_THICKFRAME; 
    	cs.style &= ~WS_MAXIMIZEBOX; 
    	return CFrameWnd::PreCreateWindow(cs);
    }

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Client Maximizing

    You may try to handle WM_WINDOWPOSCHANGING message
    Victor Nijegorodov

  8. #8
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: Client Maximizing

    Quote Originally Posted by GCDEF View Post
    Code:
    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    	cs.style &= ~WS_THICKFRAME; 
    	cs.style &= ~WS_MAXIMIZEBOX; 
    	return CFrameWnd::PreCreateWindow(cs);
    }
    Thanks a lot .. This is working perfect!

  9. #9
    Join Date
    May 2009
    Location
    Bengaluru, India
    Posts
    460

    Re: Client Maximizing

    Quote Originally Posted by VictorN View Post
    You may try to handle WM_WINDOWPOSCHANGING message
    Thanks. The solution mentioned in other post ( handling in precreateWindow() function ) worked so did not try this.
    Will keep this in mind incase if required in future will use it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured