main.html
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wP, LPARAM lP) {
PAINTSTRUCT ps;
HBRUSH hBrush;
HDC hdc;
RECT rect;
switch(msg) {
case WM_PAINT:
BeginPaint(hwnd, &ps);
hdc = GetDC(hwnd);
GetClientRect(hwnd, &rect);
hBrush = CreateSolidBrush(RGB(0, 77, 77));
hBrush = (HBRUSH) SelectObject(hdc, hBrush);
Rectangle(hdc, 80,80,rect.right,rect.bottom);
DeleteObject(SelectObject(hdc, hBrush));
EndPaint(hwnd, &ps);
break;
case WM_DESTROY: {
PostQuitMessage(0);
break;
}
default:
return DefWindowProc(hwnd, msg, wP, lP);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hI, HINSTANCE hPI, LPSTR szCL, int iCS) {
WNDCLASSEX wc; HWND hwnd;
MSG msg; memset(&wc,0,sizeof(wc));
wc.cbSize = sizeof(WNDCLASSEX);
wc.lpfnWndProc = WndProc;
wc.hInstance = hI;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszClassName = "WindowClass";
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if(!RegisterClassEx(&wc)) {
MessageBox(
NULL,
"Window Registration Failed!",
"Error!",
MB_ICONEXCLAMATION | MB_OK
);
return 0;
}
hwnd = CreateWindowEx(
WS_EX_CLIENTEDGE,
"WindowClass",
"Desenha um retângulo",
WS_VISIBLE | WS_OVERLAPPEDWINDOW,
200, 40, 360, 360, NULL,
NULL,
hI,
NULL
);
if(hwnd == NULL) {
MessageBox(
NULL,
"Window Creation Failed!",
"Error!",
MB_ICONEXCLAMATION|MB_OK
);
return 0;
}
while(GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); }
return msg.wParam;
}
Comentários
Postar um comentário