int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
// Registro de la clase de la ventana
const char CLASS_NAME[] = "Sample window class";
WNDCLASS wc = { };
wc.lpfnWndProc = WindowProc;
wc.hInstance = hInstance;
wc.lpszClassName = CLASS_NAME;
RegisterClass(&wc);
// Crear la ventana
HWND hwnd = CreateWindowEx(
0, CLASS_NAME, "Timer example",
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL
);
ShowWindow(hwnd, nShowCmd);
// Crear el timer
SetTimer(hwnd, 1, 1000, NULL); // Timer ID 1, cada 1000 ms (1 segundo)
// Bucle de mensajes
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}