Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::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 09: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[117044]
2D Rotated Rectangles Collision Detection[88979]
Keyboard Hook[77317]
UDP[65822]
HTTP Proxy[41211]

::Top 5 Samples::
2D ColDet Rotated Rectangles[11561]
PS2 Mouse Driver[6958]
Wave Format Player[5792]
Reading FAT12[5620]
CodeGuru[5359]


All rights reserved to RageStorm © 2009