void PaintMe(HWND hwnd) { HDC hDC; PAINTSTRUCT ps; RECT rcWindow; HFONT hSysFont, hFont, hFontOld; LOGFONT lfFont; COLORREF crText; TCHAR szTextBuffer[50], szTextBuffer2[50], szInternetTime[5]; XString xsTextBuffer; int iFontSizePixel; GetWindowRect(hwnd, &rcWindow); OffsetRect(&rcWindow, -rcWindow.left, -rcWindow.top); hDC = BeginPaint(hwnd, &ps); SetBkMode(hDC, TRANSPARENT); if (bSelected == TRUE) { HBRUSH hBrush = GetSysColorBrush(COLOR_HIGHLIGHT); FillRect(hDC, &rcWindow, hBrush); DeleteObject(hBrush); } if (g_iTextSize == 0) { SHGetUIMetrics(SHUIM_FONTSIZE_PIXEL, &iFontSizePixel, sizeof(iFontSizePixel), NULL); } else { iFontSizePixel = MulDiv(g_iTextSize + MIN_FONT_SIZE - 1, DRA::LogPixelsY(), 72); } hSysFont = (HFONT) GetStockObject(SYSTEM_FONT); GetObject(hSysFont, sizeof(LOGFONT), &lfFont); //memset(&lfFont, 0, sizeof(LOGFONT)); lfFont.lfWeight = FW_SEMIBOLD; lfFont.lfHeight = -iFontSizePixel; hFont = CreateFontIndirect(&lfFont); hFontOld = (HFONT) SelectObject(hDC, hFont); crText = SendMessage(GetParent(hwnd), TODAYM_GETCOLOR, (WPARAM) TODAYCOLOR_TEXT, NULL); SetTextColor(hDC, crText); InflateRect(&rcWindow, -2, 0); _itot(g_iInternetTime, szInternetTime, 10); //_ttoi _tcscpy(szTextBuffer, _T("a\0")); GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, &g_stLocalTime, g_xsLeftFormat.Replace(_T("'"), _T("'''")).GetBuffer(), szTextBuffer, sizeof szTextBuffer); GetDateFormat(LOCALE_SYSTEM_DEFAULT, 0, &g_stLocalTime, szTextBuffer, szTextBuffer2, sizeof szTextBuffer2); xsTextBuffer = XString(szTextBuffer2).Replace(_T("@"), XString(_T("@"), szInternetTime)); DrawText(hDC, xsTextBuffer.GetBuffer(), -1, &rcWindow, DT_VCENTER | DT_LEFT); _tcscpy(szTextBuffer, _T("a\0")); GetTimeFormat(LOCALE_SYSTEM_DEFAULT, 0, &g_stLocalTime, g_xsRightFormat.Replace(_T("'"), _T("'''")).GetBuffer(), szTextBuffer, sizeof szTextBuffer); GetDateFormat(LOCALE_SYSTEM_DEFAULT, 0, &g_stLocalTime, szTextBuffer, szTextBuffer2, sizeof szTextBuffer2); xsTextBuffer = XString(szTextBuffer2).Replace(_T("@"), XString(_T("@"), szInternetTime)); DrawText(hDC, xsTextBuffer.GetBuffer(), -1, &rcWindow, DT_VCENTER | DT_RIGHT); SelectObject(hDC, hFontOld); DeleteObject(hFont); EndPaint(hwnd, &ps); }