Home
Tutorials
Code Snippets
Code Samples
Downloads
The Forum
Links

The Blog
Our Projects
Guest Book
About
Contact

ShOuT b0X:
::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Code Snippet - Full Screen Window
Author:WebMaster
Category:Win32API
File Size:~ 1.32 KB
Uploaded at:20-Mar-05 04:18:02 pm
Description:
  Shows how to create a top most full screen window.
  
#include <windows.h>

#define MYCLASSNAME ("__someclassname__")
LRESULT CALLBACK WinProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
switch (Msg)
{
case WM_LBUTTONDOWN:
MessageBox(NULL, "Left button is down!", NULL, MB_OK);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd, Msg, wParam, lParam);
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCommandLine, int nShowCmd)
{
MSG msg;
WNDCLASS wc = {0};
wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
wc.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
wc.lpszClassName = MYCLASSNAME;
wc.hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW));
wc.hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION));
wc.hInstance = hInstance;
wc.lpfnWndProc = WinProc;
RegisterClass(&wc);

HWND hWnd = CreateWindow(MYCLASSNAME, "FullScreenWnd", WS_POPUP, 0, 0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, hInstance, NULL);

SetWindowLong(hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) | WS_EX_TOPMOST);
ShowWindow(hWnd, nShowCmd);
UpdateWindow(hWnd);

BOOL bRet;
while ((bRet = GetMessage(&msg, NULL, 0, 0)) != 0) { 
if (bRet == -1) break;
else {
TranslateMessage(&msg); 
DispatchMessage(&msg); 
}
}
return -1;
}
User Contributed Comments(None)
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[78821]
2D Rotated Rectangles Collision Detection[65777]
Keyboard Hook[62301]
UDP[44155]
HTTP Proxy[31808]

::Top 5 Samples::
2D ColDet Rotated Rectangles[9501]
PS2 Mouse Driver[5619]
Reading FAT12[4453]
Wave Format Player[4435]
CodeGuru[4124]

::Link to RageStorm::

::Affiliates::
AngelCode
YOV408 Technologies
FireStorm


All rights reserved to RageStorm © 2009