设为首页 加入收藏

TOP

MFC开发(一)简单同步时间应用程序(二)
2019-01-11 00:14:25 】 浏览:219
Tags:MFC 开发 简单 同步 时间 应用程序
__cdecl time(time_t
*); #ifdef _POSIX_ _CRTIMP void __cdecl tzset(void); #else _CRTIMP void __cdecl _tzset(void); #endif /* --------- The following functions are OBSOLETE --------- */ /* The Win32 API GetLocalTime and SetLocalTime should be used instead. */ unsigned __cdecl _getsystime(struct tm *); unsigned __cdecl _setsystime(struct tm *, unsigned); /* --------- The preceding functions are OBSOLETE --------- */ #ifndef _SIZE_T_DEFINED typedef unsigned int size_t; #define _SIZE_T_DEFINED #endif #ifndef _MAC #ifndef _WTIME_DEFINED /* wide function prototypes, also declared in wchar.h */ _CRTIMP wchar_t * __cdecl _wasctime(const struct tm *); _CRTIMP wchar_t * __cdecl _wctime(const time_t *); _CRTIMP size_t __cdecl wcsftime(wchar_t *, size_t, const wchar_t *, const struct tm *); _CRTIMP wchar_t * __cdecl _wstrdate(wchar_t *); _CRTIMP wchar_t * __cdecl _wstrtime(wchar_t *); #define _WTIME_DEFINED #endif #endif /* ndef _MAC */ #if !__STDC__ || defined(_POSIX_) /* Non-ANSI names for compatibility */ #define CLK_TCK CLOCKS_PER_SEC _CRTIMP extern int daylight; _CRTIMP extern long timezone; _CRTIMP extern char * tzname[2]; _CRTIMP void __cdecl tzset(void); #endif /* __STDC__ */ #ifdef __cplusplus } #endif #ifdef _MSC_VER #pragma pack(pop) #endif /* _MSC_VER */ #endif /* _INC_TIME */

接着我们在initinstance类里添加如下函数:

DrawText(hdc, szTimerTitle, strlen(szTimerTitle), &rt, DT_CENTER);





case WM_TIMER:
            if(wParam == WM_TIMER_CLOCK)
            {
            time(&long_date);                   //获取时间
            newdate=localtime(&long_date);   //转化为本地时间
            memset(szTimerTitle,0,sizeof(szTimerTitle));
            strcpy(szTimerTitle,asctime(newdate));   //打印时间            
            UpdateWindow(hWnd);    
            break;
            }

这个程序其实并没有多少东西,但是主要自己智商时常不在线,在进行重做的时候有点zz,导致自己的分析过程短路。是以后应该避免的。

首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇hdu 6441 Find Integer(费马大定.. 下一篇c/c++ 继承与多态 文本查询的小例..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目