类比时钟不必关心国际化问题,但是由於图形所引起的复杂性却抵消了这种简化。为了正确地产生时钟,您需要知道一些三角函数。CLOCK如程式8-4所示。
程式8-4 CLOCK
CLOCK.C
/*---------------------------------------------------------------------------
CLOCK.C -- Analog Clock Program
(c) Charles Petzold, 1998
---------------------------------------------------------------------------*/
#include <windows.h>
#include <math.h>
#define ID_TIMER 1
#define TWOPI (2 * 3.14159)
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance,
CLOCK.C
/*---------------------------------------------------------------------------
CLOCK.C -- Analog Clock Program
(c) Charles Petzold, 1998
---------------------------------------------------------------------------*/
#include <windows.h>
#include <math.h>
#define ID_TIMER 1
#define TWOPI (2 * 3.14159)
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain ( HINSTANCE hInstance, HINSTANCE hPrevInstance,