DWORD fsGetTimeDelta (const SYSTEMTIME *t1, const SYSTEMTIME *t2) { FILETIME ft1, ft2; SystemTimeToFileTime (t1, &ft1); SystemTimeToFileTime (t2, &ft2); return fsGetTimeDelta (&ft1, &ft2); }
void vmsAppSmallTipsMgr::SetupCurrentTipIndex() { int nCurrentTip = _App.SmallTips_CurrentTip (); FILETIME ft = _App.SmallTips_LastTime (); FILETIME ftCurrent; SYSTEMTIME st; GetLocalTime (&st); SystemTimeToFileTime (&st, &ftCurrent); if (ft.dwHighDateTime == 0) { _App.SmallTips_LastTime (ftCurrent); } else { int nDelta = fsGetTimeDelta (&ftCurrent, &ft); if (nDelta > 24*3600) { nCurrentTip++; _App.SmallTips_CurrentTip (nCurrentTip); _App.SmallTips_LastTime (ftCurrent); } } if (nCurrentTip < 0 || nCurrentTip >= (int)m_vTips.size ()) { nCurrentTip = 0; _App.SmallTips_CurrentTip (nCurrentTip); } m_nCurrentTip = nCurrentTip; if (isDisabledTipIndex (m_nCurrentTip)) { while (isDisabledTipIndex (++m_nCurrentTip) && m_nCurrentTip != nCurrentTip) { if (m_nCurrentTip >= m_vTips.size ()) m_nCurrentTip = -1; } assert (m_nCurrentTip != nCurrentTip); _App.SmallTips_CurrentTip (m_nCurrentTip); } }