如何将Win32应用程序设置为全屏(C ++) [英] How to Set Win32 Application to Full Screen (C++)

查看:535
本文介绍了如何将Win32应用程序设置为全屏(C ++)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何将窗口设置为全屏显示(没有菜单和标题栏)吗?我的代码没有使用任何.net内容,而只是C ++本机Win32代码.我已经找到了适用于移动平台的答案,但找不到适用于普通应用程序的答案.

Does anyone know how to set a Window to full screen (without the menu and title bar)? My code isn''t using any .net stuff, it''s all just C++ native Win32 code. I have found the answer for mobile platforms, but can''t find it for normal apps.

推荐答案

您必须处理WM_GETMINMAXINFO消息,然后使用SetWindowPos将窗口调整为屏幕大小.
若要获取屏幕的大小,请在SPI_GETWORKAREASPI_GETWORKAREA之间使用SystemParametersInfo.
您还需要隐藏菜单和状态栏.
You have to handle the WM_GETMINMAXINFO message and then use SetWindowPos to resize the window to the size of the screen.
To get the size of the screen, use SystemParametersInfo with SPI_GETWORKAREA.
You will need to hide the menu and status bar also.


首先,在此处查看我对问题的粗体部分的回答:
http://www.codeproject.com/Messages/3408829/Re-Remove-Title- Bar.aspx [ ^ ]
接下来将窗口移至屏幕尺寸:
First, see my answer to the bolded part of the question question here:
http://www.codeproject.com/Messages/3408829/Re-Remove-Title-Bar.aspx[^]
Next move the window to the screen size:
// move to full screen (main monitor)
HDC hDC = ::GetWindowDC(NULL); 
::SetWindowPos(hWnd, NULL, 0, 0, ::GetDeviceCaps(hDC, HORZRES), ::GetDeviceCaps(hDC, VERTRES), SWP_FRAMECHANGED);


对于多台显示器,需要做一些功课:)
欢呼声,
AR

由于编辑愚蠢,已还原为原始:(


For multiple monitors handling, some homework needed :)
cheers,
AR

Reverted to original as the edit was stupid :(


这篇关于如何将Win32应用程序设置为全屏(C ++)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆