MFC maximizes taskbar display

Source: Internet
Author: User

Today 2016-07-23 13:26:24 again to handle the bug that the window taskbar hides when maximized.

It's already in front.

struct {  // without  // maximum range  // maximum drop point  // Minimum drag range  // maximum drag range } Minmaxinfo;

http://blog.csdn.net/whh_1218/article/details/8495649: Here's the method, feel the lack of what, some variables do not know. Also know how to deal with the ongetminmaxinfo () message function.

voidMaindialog::ongetminmaxinfo (Minmaxinfo far*Lpmmi) {    //todo:add your message handler code here and/or call default//lpmmi->ptmaxsize.y = GetSystemMetrics (sm_cyfullscreen) + getsystemmetrics (sm_cycaption) + GetSystemMetrics (SM _cydlgframe);CRect RT; SystemParametersInfo (Spi_getworkarea,0, &rt,0); Lpmmi->ptmaxsize.x =Rt.    Width (); Lpmmi->ptmaxsize.y =Rt.    Height (); Lpmmi->ptmaxtracksize.x =Rt.    Width (); Lpmmi->ptmaxtracksize.y =Rt.    Height (); Cdialog::ongetminmaxinfo (Lpmmi);}

This effect, when the vertical is not good, the size of the window is determined, but the upper left corner of the coordinate is not right!

Then study, determine the size of the task bar method, think really to divide the situation, discuss the size of the window.

To get the desktop workspace size, which does not include the size of the taskbar, it is often used when making a full-screen window, as follows:

RECT RT; SystemParametersInfo (Spi_getworkarea,0, (PVOID) &rt,0);

CRect rect;
:: GetWindowRect (:: FindWindow (_t ("Shell_traywnd"), NULL), &rect); Getting the taskbar size

There are two ways to get the height and width of the taskbar:

1. Judge position rect RT; SystemParametersInfo (Spi_getworkarea,0, &rt,0)//Get workspace size//taskbar at the height below  inty =:: GetSystemMetrics (Sm_cyscreen)-Rt. Height ();inty = rt.top;//above  inty = rt.left;//left  inty =:: GetSystemMetrics (Sm_cxscreen)-rt. Width ();//Right
2the height can then be judged by the position CRect rect; CWnd*pwndprev= FindWindow ("Shell_traywnd","");//call this object, which is the FindWindow function of this, to return the window pointerPwndprev->getwindowrect (&rect); //Rect.bottom-rect.top is the height of the taskbar.if(rect.top>0)//belowif(rect.left>0)//leftor CWnd .* p =NULL; HWND hwnd=:: FindWindow ("Shell_traywnd", NULL);//Call the public FindWindow function to return the window handle       if(HWND) {p=Cwnd::fromhandle (HWND); } P->getwindowrect ();//contains a width

Finally suddenly want to take since SystemParametersInfo (Spi_getworkarea, 0, &rt, 0); all get the size of the work form, directly movewindow (RT); that's it. It's just a bug when you move back, but it's acceptable.

Once again proves that sometimes, can not just set other people's method, oneself still must move the brain, uses own method to realize. To believe in yourself, there are ideas that can work.

MFC maximizes taskbar display

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.