Maximize hides task bar
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Maximize hides task bar

  1. #1
    Join Date
    Apr 2007
    Posts
    153

    Maximize hides task bar

    Visual Studio 2008 pro

    MFC Dialog app.

    In OnInitDialog() I include the following lines:

    ShowWindow(SW_SHOWDEFAULT);
    ShowWindow(SW_MAXIMIZE);

    This maximizes the window but it overwrites the task bar. How do I maximize the window of the app and still have the task bar visible ??

    Thanks
    Zapper

  2. #2
    Join Date
    Apr 2009
    Posts
    598

    Re: Maximize hides task bar

    This maximizes the window but it overwrites the task bar.
    Not always. It depends on the properties of the task bar.

  3. #3
    Join Date
    Apr 2007
    Posts
    153

    Re: Maximize hides task bar

    If you are referring to the property "Keep the taskbar on top of other windows" that is selected and my app still "overwrites" it.


    Zapper

  4. #4
    Join Date
    Apr 2007
    Posts
    153

    Re: Maximize hides task bar

    Ok I figured out what the deal was with this and I will put this up in case someone else runs into the same problem.

    It seems that if you remove the maximize box and you use ShowWindow(SW_MAXIMIZE) your app will fill the screen, even overpainting the task bar, if you leave the maximize box in the project and use the same command, the taskbar will remain visible.

    My issue was that I only wanted the app to run maximized AND still have the task bar visible without allowing the user access to a restore button.

    You can accomplish this if you override the OnSysCommand. The app I was writing already included an OnSysCommand function to handle the About Box so I modified it like this and got the results I wanted.
    Code:
    void CMyApp::OnSysCommand(UINT nID, LPARAM lParam)
    {
    	
    	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
    	{
    		CAboutDlg dlgAbout;
    		dlgAbout.DoModal();
    	}
    	else
    	{
    		if(nID == SC_RESTORE){
    			if(IsIconic())
    				ShowWindow(SW_MAXIMIZE);
    		}else{
    			CDialog::OnSysCommand(nID, lParam);
    		}
    	}
    }

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center