Reputation: 81
How can I make a true full screen mode in VC++?
#include <windows.h>
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("screen") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("Program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, TEXT ("Digital Clock"),
WS_POPUP|WS_DLGFRAME|WS_VISIBLE, // _OVERLAPPEDWINDOW| WS_MAXIMIZE,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;
ShowWindow (hwnd, SW_MAXIMIZE);// iCmdShow) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
Upvotes: 1
Views: 2807
Reputation: 71060
Games usually use DirectX which has a mode that takes exclusive use of the video output - this means no other window (or task bar) can draw to the screen and the whole screen is available to the application at whatever resolution and colour depth you want (well almost, whatever the video card supports).
Upvotes: 1
Reputation: 9986
See Can a window be always on top of just one other window?
In case of multiple window set to AlwaysOnTop; than only that window will remain on top that has been manually brought on top. For instance there are two windows Window1 and Window2; then when you would run window1.exe, it would be the window on top; and when you would run window2.exe then that window would be on top, thats the default behavior.
Otherwise if you must not allow any other window to get on top, you will have to look for other apps being invoked after yours, and then probably hook those windows somehow and, well probably call its Minimize event to send it to the task bar.
Upvotes: 1
Reputation: 2601
Check out this function and look at the definition of WS_EX_TOPMOST...
Upvotes: 1
Reputation: 62323
Does
SetWindowPos( hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
not put it on top of the taskbar?
Upvotes: 1