How can I create a full screen window?
what must change in this program? or what should I add?:
#undef UNICODE
#define STRICT
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CLOSE:
DestroyWindow(hwnd);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hwnd,msg,wParam,lParam);
}
}
void register_class(const HINSTANCE& hInstance)
{
WNDCLASSEX wcx;
wcx.cbSize = sizeof(WNDCLASSEX);
wcx.style = 0;
wcx.lpfnWndProc = WndProc;
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hInstance = hInstance;
wcx.hIcon = LoadIcon(0,IDI_APPLICATION);
wcx.hCursor = LoadCursor(0,IDC_ARROW);
wcx.hbrBackground = (HBRUSH)(COLOR_WINDOWFRAME);
wcx.lpszMenuName = 0;
wcx.lpszClassName = "classname";
wcx.hIconSm = LoadIcon(0,IDI_APPLICATION);
RegisterClassEx(&wcx);
}
void message_loop()
{
MSG Msg;
while(GetMessage(&Msg,0,0,0) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
}
void create_window(const int& nCmdShow)
{
HWND hwnd = CreateWindowEx
(
0 ,// dwExStyle
"classname" ,// lpClassName
"title" ,// lpWindowName
WS_OVERLAPPEDWINDOW ,// dwStyle
CW_USEDEFAULT ,// x
0 ,// y
CW_USEDEFAULT ,// nWidth
0 ,// nHeight
0 ,// hWndParent
0 ,// hMenu
0 ,// hInstance
0 // lpParam
);
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
register_class(hInstance);
create_window(nCmdShow);
message_loop();
return 0;
}
Edited by irancplusplus, 20 November 2011 - 05:42 PM.


Sign In
Create Account


Back to top









