Pos); flash.GetWindowPlacement(&m_FlashPos); flash.GetWindowRect(flashrect); CSliderCtrl *m_pSlider=(CSliderCtrl*)GetDlgItem(IDC_SLIDER1); m_pSlider->ShowWindow(SW_HIDE ); HWND hwnd=this->GetSafeHwnd(); LONG style=GetWindowLongPtr(hwnd,GWL_STYLE); SetWindowLongPtr(hwnd,GWL_STYLE,style-WS_CAPTION ); CClientDC dc(this); this->MoveWindow(0,0,dc.GetDeviceCaps(HORZRES),dc.GetDeviceCaps(VERTRES)); flash.SetWindowPos(&CWnd::wndTop ,0,0,dc.GetDeviceCaps(HORZRES),dc.GetDeviceCaps(VERTRES),SWP_SHOWWINDOW); screenflag=TRUE;//////////////////// } 9。响应按键ESC消息,取消全屏。 重载对话框的PreTranslateMessage()函数,在函数中添加如下代码: if(pMsg->message == WM_KEYDOWN) { if(pMsg->wParam==VK_ESCAPE) { if(screenflag) { HWND hwnd=this->GetSafeHwnd(); LONG style=GetWindowLongPtr(hwnd,GWL_STYLE); SetWindowLongPtr(hwnd,GWL_STYLE,style+WS_CAPTION ); ShowWindow(SW_HIDE); SetWindowPlacement(&m_WndPos); flash.MoveWindow(flashrect.left,flashrect.top,flashrect.Width(),flashrect.Height(),1); flash.SetWindowPlacement(&m_FlashPos); screenflag=FALSE; CSliderCtrl *m_pSlider=(CSliderCtrl*)GetDlgItem(IDC_SLIDER1); m_pSlider->ShowWindow(SW_SHOW ); } } } 全屏和取消全屏的代码,是俺自己拼凑所得,充其量只是个模拟效果,而且还是个模拟的不好的效果,如果有高手见到,希望能够博您一笑。另外,在笑过之后还请您不吝赐教。
摘自 家里蹲博客
|