How to create full screen window with MFC?

…衆ロ難τιáo~ 提交于 2019-12-23 03:11:57

问题


I want to create full screen topmost (screen saver) window with MFC? How to create such full screen window in MFC? I tried to create win32 application and i am able to create fullscreen top most window but i want to create using MFC so later i can put different MFC controls on that window?

Please help me.

Thanks, Jim.


回答1:


You should be able to adapt the example code here to do what you want:

MSDN: Initializing a dialog box




回答2:


I do it with a Dialog Box app. In the resource editor properties for the dialog resource, set Border=None and Title Bar=False to eliminate all border elements. In OnInitDialog, use the following to resize the dialog to the entire desktop:

CRect rcDesktop;
rcDesktop.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
rcDesktop.right = rcDesktop.left + GetSystemMetrics(SM_CXVIRTUALSCREEN);
rcDesktop.top = GetSystemMetrics(SM_YVIRTUALSCREEN);
rcDesktop.bottom = rcDesktop.top + GetSystemMetrics(SM_CYVIRTUALSCREEN);
MoveWindow(rcDesktop, FALSE);

This code works on multiple monitors, unlike maximizing the window.

No need to worry about making the window topmost, Windows will display it on a dedicated desktop with no other windows present.




回答3:


I think removing the border from the dialog resource and showing the window as maximized (ShowWindow(SW_SHOWMAXIMIZED)) should do the job.

As for topmost use the System Modal style in the dialog resource.



来源:https://stackoverflow.com/questions/1832835/how-to-create-full-screen-window-with-mfc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!