界面全屏显示比较好实现,但留下一个洞,还是很好玩的。
这里实现这个功能。
关键代码如下
- //隐藏WINDOWS系统任务栏
- ::ShowWindow (::FindWindow("Shell_TrayWnd",NULL),SW_HIDE);
- char m_pAppRootPath[256]={0};
- ::GetModuleFileName(NULL,m_pAppRootPath,MAX_PATH);
- (_tcsrchr(m_pAppRootPath, _T('\\')))[1] = 0;//删除文件名,只获得路径
- CString str;
- str=m_pAppRootPath;
- str+="\\Show91Mobile.bmp";
-
- HBITMAP m_hbitmap = (HBITMAP)::LoadImage(GetModuleHandle(NULL),str,
- IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_DEFAULTSIZE|LR_DEFAULTCOLOR);
- m_Picture.SetBitmap(m_hbitmap);
- CRect rect;
- m_Picture.GetWindowRect(rect);
- //m_Picture.set
- CRect m_rect;
-
- GetWindowRect(m_rect);
-
- CRect desktoprect;
- GetDesktopWindow()->GetWindowRect(&desktoprect);
- int x=0;
- int y=0;
-
- x=desktoprect.Width();
- y=desktoprect.Height();
-
- MoveWindow(CRect(0,0,x,y));
- ShowWindow(TRUE);
- //CenterWindow();
-
- //-----------
- CRect rect1;
- GetWindowRect(rect1);
-
- CRect rect2;
- GetClientRect(rect2);
- ClientToScreen(rect2);
-
- CRgn rgn1;
- rgn1.CreateRectRgn(0, 0, x, y);
-
- int nwidth=480;//洞宽
- int nhight=768;//洞高
-
- CRgn rgn2; //洞开在屏中间部份
- rgn2.CreateRectRgn((x-nwidth)/2, (y-nhight)/2, (x-nwidth)/2+nwidth, (y-nhight)/2+nhight);
-
- CRgn rgn;
- rgn.CreateRectRgn(0, 0, 1, 1);
-
- rgn.CombineRgn(&rgn1, &rgn2, RGN_DIFF);
-
- //设置窗口区域
- SetWindowRgn((HRGN)rgn,TRUE);
- ModifyStyleEx (WS_EX_APPWINDOW,WS_EX_TOOLWINDOW|WS_EX_TOPMOST );
-
- const CWnd * pWndInsertAfter;
- pWndInsertAfter = &wndTopMost;
- SetWindowPos(pWndInsertAfter,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);
复制代码
|