跪求Win7全屏代码.解决方案

跪求Win7全屏代码.
小弟 抄了一份代码如下:


void CXXXDlg::SetFullScreen()
{
int frameWidth =  GetSystemMetrics(SM_CXFRAME);
int frameHeight = GetSystemMetrics(SM_CYFRAME);
int captionHeight = GetSystemMetrics(SM_CYCAPTION);
int screenWidth = GetSystemMetrics(SM_CXSCREEN);
int screenHeight = GetSystemMetrics(SM_CYSCREEN);
CRect rect;
GetClientRect(&rect);
rect.left = rect.left - frameWidth;
rect.top = rect.top - frameHeight - captionHeight ;
rect.bottom = rect.top + screenHeight + 2 * frameHeight + captionHeight;
rect.right = rect.left + screenWidth + 2 * frameWidth;
ShowWindow(SW_HIDE);
SetWindowPos(&wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW);
}



在xp下一切正常,可是在win7下,竟然上下左右都有一个边.
------解决思路----------------------
引用:
Quote: 引用:

几行代码的事你写那么多干嘛

CRect rect;
::GetClientRect(::GetDesktopWindow(), &rect);
SetWindowPos(&wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW);


刚才试了一下,  好像还是最大化, 不是全屏.


是你没有分清全屏和最大化的区别
你平时所接触的所谓"全屏"的窗口, 它们都是没有标题栏和边框的, 而是整个客户区占据屏幕所有位置
并不是你所说的标题栏和边框显示在屏幕以外

所以在你调用全屏代码前, 用 ModifyStyle 把窗口样式先修改一下
------解决思路----------------------
 WINDOWPLACEMENT newment;
    newment.length  = sizeof(WINDOWPLACEMENT);  
    newment.flags   = WPF_RESTORETOMAXIMIZED;  
    newment.showCmd = SW_SHOWMAXIMIZED;  

    newment.ptMaxPosition.x         = 0;
    newment.ptMaxPosition.y         = 0;
    newment.ptMinPosition.x         = 0;
    newment.ptMinPosition.y         = 0;
    newment.rcNormalPosition.left   = -0;
    newment.rcNormalPosition.top    = -0;
    newment.rcNormalPosition.bottom = m_rectWnd.bottom;
    newment.rcNormalPosition.right  = m_rectWnd.right;
    SetWindowPlacement(&newment);