Whenever you make a change to Cosmo's Polyline figure, it calls CPolylineAdviseSink::OnDataChange in DOCUMENT.CPP. This sets the dirty flag in the document by calling CCosmoDoc::FDirtySet, which in turn calls CFigure::SendAdvise(OBJECTCODE_DATACHANGED). We send IAdviseSink::OnDataChange notifications as necessary, but we also call IRunningObjectTable::NoteChangeTime:
case OBJECTCODE_DATACHANGED:
if (NULL!=m_pIDataAdviseHolder)
{
m_pIDataAdviseHolder->SendOnDataChange
(m_pImpIDataObject, 0, 0);
}
if (0!=m_dwRegROT)
INOLE_NoteChangeTime(m_dwRegROT, NULL, NULL);
break;
The helper function INOLE_NoteChangeTime takes the registration key from IRunningObjectTable::Register and calls the running object table for us. Its other two arguments are a FILETIME structure and a filename. If we pass NULL for the FILETIME, INOLE_NoteChangeTime will use the current time or try to obtain it from the filename:
STDAPI_(void) INOLE_NoteChangeTime(DWORD dwReg, FILETIME *pft
, LPTSTR pszFile)
{
IRunningObjectTable *pROT;
FILETIME ft;
if (NULL==pft)
{
CoFileTimeNow(&ft);
pft=&ft;
}
if (NULL!=pszFile)
GetFileTimes(pszFile, pft);
if (FAILED(GetRunningObjectTable(0, &pROT)))
return;
pROT->NoteChangeTime(dwReg, pft);
pROT->Release();
return;
}
Using the current time is good enough for Cosmo.