Code:
#include<windows.h>
#include"../clock/res.h"
LRESULT CALLBACK MainProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam){
switch(Msg){
case WM_CREATE:
{
int border_width = GetSystemMetrics(SM_CXEDGE),
border_height = GetSystemMetrics(SM_CYEDGE),
title_height = GetSystemMetrics(SM_CYCAPTION);
HRGN hRgn = CreateEllipticRgn(0, 0, 200, 200);
OffsetRgn(hRgn, border_width, title_height + border_width);
if( !hRgn )
break;
SetWindowRgn(hWnd, hRgn, TRUE);
DeleteObject(hRgn);
}
break;
case WM_DESTROY:
{
PostQuitMessage(0);
}
break;
}
return DefWindowProc(hWnd, Msg, wParam, lParam);
}
int WINAPI WinMain(
HINSTANCE hInst,
HINSTANCE hPrev,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASSEX WndCls;
WndCls.cbSize = sizeof(WNDCLASSEX);
WndCls.style = 0;
WndCls.lpfnWndProc = MainProc;
WndCls.cbClsExtra = 0;
WndCls.cbWndExtra = 0;
WndCls.hInstance = hInst;
WndCls.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICONSM));
WndCls.hIconSm = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICONSM));
WndCls.hCursor = LoadCursor(NULL, IDC_ARROW);
WndCls.hbrBackground = HBRUSH( COLOR_DESKTOP + 1);
WndCls.lpszMenuName = NULL;
WndCls.lpszClassName = "MainClass";
if( !RegisterClassEx(&WndCls) ){
MessageBox(NULL, "Error Registering Class", "Exiting...", MB_OK);
return 1;
}
HWND hWnd = CreateWindowEx(WS_EX_WINDOWEDGE, "MainClass", "Clock",
WS_SYSMENU | WS_MINIMIZEBOX,
0, 0, //CW_USEDEFAULT, CW_USEDEFAULT,
210, 250,
NULL, NULL, hInst, NULL);
if( !hWnd ){
MessageBox(NULL, "Error Creating Window", "Exiting...", MB_OK);
return 1;
}
ShowWindow(hWnd, SW_SHOW);
MSG Msg;
while( GetMessage(&Msg, NULL, 0, 0) > 0 ){
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return 0;
}
The caption & border are seen as yellow below: