窗口最大化全屏化的方法

(一)最大化

ShowWindow(SW_SHOWMAXIMIZED);该调用受OnGetMinMaxInfo影响

(二)全屏化

1.

int cx = GetSystemMetrics(SM_CXFULLSCREEN);
int cy = GetSystemMetrics(SM_CYFULLSCREEN);
CRect rt;
SystemParametersInfo(SPI_GETWORKAREA,0,&rt,0);
cy = rt.bottom;
MoveWindow(0, 0, cx, cy);

2.

RECT m_Desktop;
::GetWindowRect( ::GetDesktopWindow(), &m_Desktop );
m_Desktop.bottom = ::GetSystemMetrics( SM_CYFULLSCREEN ) + ::GetSystemMetrics( SM_CYSIZE );
int sx = m_Desktop.right;
int sy = m_Desktop.bottom;
//SetWindowPos(&wndTopMost,0,0,sx,sy,SWP_SHOWWINDOW); //让窗口处于最高层
SetWindowPos(&wndTop,0,0,sx,sy,SWP_SHOWWINDOW);//不让窗口处于最高层

 

posted @ 2013-11-01 11:17  xingrun  阅读(1202)  评论(0编辑  收藏  举报