1

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.

BIBD
  • 15,107
  • 25
  • 85
  • 137
Jim
  • 4,639
  • 5
  • 27
  • 31

3 Answers3

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.

djeidot
  • 4,542
  • 4
  • 42
  • 45
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.

Mark Ransom
  • 299,747
  • 42
  • 398
  • 622
  • 1
    Perfect. However,If I have two monitors, but I want to set full screen for only one monitor, how to do it? Thank in advance – John Mar 25 '15 at 15:35
  • @user8264 you need to get the coordinates of the monitor and use that for the MoveWindow. – Mark Ransom Mar 27 '15 at 03:07
  • @user8264: if you want to full screen on the main monitor: RECT rcDesktop; GetWindowRect(GetDesktopWindow(), &rcDesktop); MoveWindow(hWnd, rcDesktop.left, rcDesktop.top, rcDesktop.right, rcDesktop.bottom, FALSE); – andreaciri Mar 10 '17 at 16:09
1

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

MSDN: Initializing a dialog box

Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
  • This example will definitely work for me. but for that i will have to write WndProc method. can i use WndProc with MFC dialog based application? How? – Jim Dec 03 '09 at 05:49
  • ok i got it. WndPRoc is wrapped up in MFC framework. MFC application works on Message Mapping. so i will have write code into onInitDialog routine.Am i correct? – Jim Dec 03 '09 at 06:35
  • That's correct. Do all your initialization in `OnInitDialog()`. – Jon Seigel Dec 03 '09 at 13:30