November 1998
Intermediate to advanced
1520 pages
37h 53m
English
A clock is the most obvious application for the timer, so let’s look at two of them, one digital and one analog.
The DIGCLOCK program, shown in Example 8-3, displays the current time using a simulated LED-like 7-segment display.
Example 8-3. The DIGCLOCK program.
DIGCLOCK.C /*----------------------------------------- DIGCLOCK.C -- Digital Clock (c) Charles Petzold, 1998 -----------------------------------------*/ #include <windows.h> #define ID_TIMER 1 LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { static TCHAR szAppName[] = TEXT ("DigClock") ; HWND hwnd ; MSG msg ; WNDCLASS wndclass ; wndclass.style ...Read now
Unlock full access