struct _stat buf;
_fstat(_fileno(m_pStream), &buf);
CString strCurrentTime = ctime(&buf.st_ctime);
strCurrentTime.TrimRight();
CString strStoredTime =
pApp->GetProfileString(szTip, szTipTimeStamp, NULL);
if (strCurrentTime != strStoredTime)
{
iFilePos = 0;
pApp->WriteProfileString(szTip, szTipTimeStamp, strCurrentTime);
}
if (fseek(m_pStream, iFilePos, SEEK_SET) == 0)
{
GetNextTipString(m_strTip);
makeMultiLine(m_strTip);
}
(2)初始化对话框OnInitDialog()
if (m_pStream == NULL)
GetDlgItem(IDOK)->EnableWindow(FALSE);
CButton *pButton;
pButton = (CButton*)GetDlgItem(IDC_STARTUP);
pButton->SetCheck(m_bStartup);//设置选择按钮
(3)初始化界面OnPaint()
CWnd* pStatic = GetDlgItem(IDC_BULB);
CRect rect;
pStatic->GetWindowRect(&rect);
ScreenToClient(&rect);
CBrush brush;
brush.CreateStockObject(WHITE_BRUSH);
dc.FillRect(rect, &brush);
CBitmap bmp;
bmp.LoadBitmap(IDB_LIGHTBULB);//加载提示图片
BITMAP bmpInfo;
bmp.GetBitmap(&bmpInfo);
CDC dcTmp;
dcTmp.CreateCompatibleDC(&dc);
dcTmp.SelectObject(&bmp);
rect.bottom = bmpInfo.bmHeight + rect.top;
dc.BitBlt(rect.left, rect.top, rect.Width(), rect.Height(),
&dcTmp, 0, 0, SRCCOPY);
CString strMessage;
strMessage = m_didYouKonwStr;
rect.left += bmpInfo.bmWidth;
dc.DrawText(strMessage, rect, DT_VCENTER | DT_SINGLELINE);//加载提示题目
|