CSysTimeOverlayController.cpp
上传用户:hhs829
上传日期:2022-06-17
资源大小:586k
文件大小:1k
源码类别:
DirextX编程
开发平台:
Visual C++
- //
- // CSysTimeOverlayController.cpp
- //
- #include <streams.h>
- #include <stdio.h>
- #include "CSysTimeOverlayController.h"
- ////////////////////////////////////////////////////////////////////////////////////
- CSysTimeOverlayController::CSysTimeOverlayController()
- {
- }
- CSysTimeOverlayController::~CSysTimeOverlayController()
- {
- }
- // System time is as such format: YYYY-MM-DD(HH:MM:SS)
- BOOL CSysTimeOverlayController::StartTitleOverlay(void)
- {
- mCanDoOverlay = (mPixelConverter != 0);
- if (mCanDoOverlay)
- {
- // System overlay's default start position is left-top corner
- memset(&mStartPos, 0, sizeof(POINT));
- // Allocate a certain count title buffer
- ReleaseTitleBuffer();
- mTitle = new char[100];
- }
- return mCanDoOverlay;
- }
- BOOL CSysTimeOverlayController::BeforeActualOverlay(void)
- {
- // Update the current system time
- SYSTEMTIME systemTime, localTime;
- GetSystemTime(&systemTime); // This is Coordinated Universal Time (UTC)
- SystemTimeToTzSpecificLocalTime(NULL, &systemTime, &localTime);
- sprintf(mTitle, "%4d-%02d-%02d(%02d:%02d:%02d)", localTime.wYear, localTime.wMonth,
- localTime.wDay, localTime.wHour, localTime.wMinute, localTime.wSecond);
- // Update the title DIB bits
- BOOL pass = CreateTitleDIBBits();
- return pass;
- }
- BOOL CSysTimeOverlayController::AfterActualOverlay(void)
- {
- return TRUE;
- }