// CreateWnd a complete window program
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <windowsx.h>
#include <math.h>
#include <stdio.h>
#include <iostream.h>
#define WINDOW_CLASS_NAME "WINCLASS1"
LRESULT CALLBACK WindowProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){
PAINTSTRUCT ps;
HDC hdc;
switch(msg){
case WM_CREATE:
{
return 0;
}
break;
case WM_PAINT:
{
hdc = BeginPaint(hwnd,&ps);
// all paint here
EndPaint(hwnd,&ps);
return 0;
}
break;
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
break;
default :
break;
}
return (DefWindowProc(hwnd,msg,wparam,lparam));
}
int WINAPI WinMain(HINSTANCE hinstance,HINSTANCE hprevinstance,LPSTR lpcmdline,int ncmdshow){
WNDCLASSEX wndclass;
HWND hwnd;
MSG msg;
wndclass.cbSize = sizeof(WNDCLASSEX);
wndclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WindowProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hinstance;
wndclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL,IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = WINDOW_CLASS_NAME;
wndclass.hIconSm = LoadIcon(NULL,IDI_APPLICATION);
if(!RegisterClassEx(&wndclass))
return 0;
if(!(hwnd = CreateWindowEx(NULL,WINDOW_CLASS_NAME,"BL",WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0,0,400,400,NULL,NULL,hinstance,NULL)))
return 0;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}