
#pragma comment(lib, "dwmapi.lib")
#include <windows.h>
#include <dwmapi.h>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE
hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
HBRUSH hbrush = CreateSolidBrush(RGB(0,0,0));
MSG msg ;
WNDCLASS wc = {0};
wc.lpszClassName = TEXT( "stdio Glass Trial" );
wc.hInstance = hInstance ;
wc.hbrBackground = hbrush;
wc.lpfnWndProc = WndProc ;
wc.hCursor = LoadCursor(0,IDC_ARROW);
RegisterClass(&wc);
CreateWindow( wc.lpszClassName, TEXT("stdio Glass Trial"),
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
200, 200, 400, 400, 0, 0, hInstance, 0);
while( GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
HRESULT ExtendIntoClientAll(HWND hwnd)
{
// Negative margins have special meaning to DwmExtendFrameIntoClientArea.
// Negative margins create the "sheet of glass" effect, where the client area
// is rendered as a solid surface with no window border.
MARGINS margins = {-1};
HRESULT hr = S_OK;
// Extend frame across entire window.
hr = DwmExtendFrameIntoClientArea(hwnd,&margins);
if (SUCCEEDED(hr))
{
//do more things
}
return hr;
}
LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam,LPARAM lParam )
{
switch(msg)
{
case WM_CREATE:
{
return 0;
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
case WM_PAINT:
{
ExtendIntoClientAll(hwnd);
break;
}
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}
Feel free to ask any question since it is not commented.
Edited by Alexander, 08 April 2011 - 02:45 PM.
(Moved to classes and code snippets)


Sign In
Create Account


Back to top









