LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
static TCHAR szAppName[] = TEXT("Win32Hello");
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
if (!RegisterClass(&wndclass)) {
MessageBox(NULL, TEXT("Class registration failed"),
szAppName, MB_ICONERROR);
hwnd = CreateWindow(szAppName, TEXT("Win32 Hello"),
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
ShowWindow(hwnd, nShowCmd);
while (GetMessage(&msg, NULL, 0, 0)) {
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
GetClientRect(hwnd, &rc);
CreateWindow(TEXT("static"), TEXT("Hello"),
WS_CHILD | WS_VISIBLE | SS_LEFT,
0, 0, rc.right, rc.bottom,
(HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
return DefWindowProc(hwnd, message, wParam, lParam);