在校实训项目万年历、实时时钟遇到难处,请求大神帮助。

求救 在校实训项目万年历、实时时钟遇到难处,请求大神帮助。。
本帖最后由 u011305601 于 2013-12-19 14:55:38 编辑

#include "public.h"
#include <math.h>
#define ID_TIMER     1
#define TWOPI    (2 * 3.14159)
/*略去部分

 LRESULT CALLBACK MClock(HWND hwnd, UINT message, WPARAM wParam,LPARAM lParam)
{
      static int        cxClient, cyClient ;
      static SYSTEMTIME stPrevious ;
      BOOL               fChange ;
      HDC                hdc ;
      PAINTSTRUCT        ps ;
      SYSTEMTIME         st ;

      switch (message)
      {
      case  WM_CREATE :
           SetTimer (hwnd, ID_TIMER, 1000, NULL) ;
           GetLocalTime (&st) ;
           stPrevious = st ;
           return 0 ;

      case  WM_SIZE :
           cxClient = LOWORD (lParam) ;
           cyClient = HIWORD (lParam) ;
           return 0 ;

      case  WM_TIMER :
           GetLocalTime (&st) ;

           fChange =  st.wHour!= stPrevious.wHour ||
                     st.wMinute != stPrevious.wMinute ;

           hdc = GetDC (hwnd) ;

           SetIsotropic (hdc, cxClient, cyClient) ;

           SelectObject (hdc, GetStockObject (WHITE_PEN)) ;
           DrawHands (hdc, &stPrevious, fChange) ;

           SelectObject (hdc, GetStockObject (BLACK_PEN)) ;
           DrawHands (hdc, &st, TRUE) ;

           ReleaseDC (hwnd, hdc) ;

           stPrevious = st ;
           return 0 ;

      case  WM_PAINT :
           hdc = BeginPaint (hwnd, &ps) ;

           SetIsotropic (hdc, cxClient, cyClient) ;
           DrawClock    (hdc) ;
           DrawHands    (hdc, &stPrevious, TRUE) ;

           EndPaint (hwnd, &ps) ;
           return 0 ;

      case  WM_DESTROY :
           KillTimer (hwnd, ID_TIMER) ;
           PostQuitMessage (0) ;
           return 0 ;
     }
      return TRUE;
}


INT_PTR ShowMClock()
{
return DialogBox(g_hInst,MAKEINTRESOURCE(IDD_DIALOG2),g_hMainWnd,MClock);
}

------解决方案--------------------
LRESULT CALLBACK MClock(HWND hwnd, UINT message, WPARAM wParam,LPARAM lParam)