In my application I want to reload a document if it has been modified
outside the source editor. So I'm using FindFirstChangeNotification to
detect for a change in the directory. I have a WaitForMultipleObjects on the
handle returned.
My problem occurs if the user is running the application on Windows 98. If
the document is modified by a user on another Computer,
WaitForMultipleObjects doesn't register the change and thus the document is
not updated. Any ideas why this might be happening and what can I do ?
Everything works fine on Win NT !!
Thanks & Regards,
Mohan
Its something like this -
HANDLE aHandles[2];
aHandles[0] = hChange;
aHandles[1] = hEvent;
while (bContinue)
{
if((::WaitForMultipleObjects(2, aHandles, FALSE, INFINITE) -
WAIT_OBJECT_0) == 0)
{
if(pWnd)
{
//Check if the document that we are monitoring has changed
//if it has then display a message and reload it
CFile::GetStatus(LPCTSTR(sFileName),rStatus);
if(rStatus.m_mtime.GetTime() > tCurrentTime.GetTime())
{
tCurrentTime = rStatus.m_mtime;
if((CMyDocument*)pDocument)->m_iDocumentStatus == READONLY)
{
//We need to send this message only for Read Only Documents
pWnd->PostMessage(uRefreshDocument,(WPARAM)pDocument);
}
}
}
if(::FindNextChangeNotification (hChange))
{
bContinue = TRUE;
}
else
{
bContinue = FALSE;
}
}
else
{
// Kill this thread (m_event became signaled).
bContinue = FALSE;
}
}
// Close the file change notification handle and return.
::FindCloseChangeNotification (hChange);
return 0;