谢谢。该问题我已问过数人,没有解决。

解决方案 »

  1.   

    写了多少次可以用 FindFirstChangeNotification/FindNextChangeNotification 来监控,
    打开与读不知道。
      

  2.   

    我见打开只能用API HOOK了DWORD dwWaitStatus; 
    HANDLE dwChangeHandles; 
     
    // Watch the C:\WINDOWS directory for file creation and 
    // deletion. 
     
    dwChangeHandles = FindFirstChangeNotification( 
        "C:\\The_Dirctory_Your_File_In",                 // directory to watch 
        FALSE,                         // do not watch the subtree 
        FILE_NOTIFY_CHANGE_LAST_WRITE); // watch file name changes 
     
    if (dwChangeHandles[0] == INVALID_HANDLE_VALUE) 
        ExitProcess(GetLastError()); 
     
    // Change notification is set. Now wait on both notification 
    // handles and refresh accordingly. 
     
    while (TRUE) 

     
        // Wait for notification.
    dwWaitStatus = WaitForSingleObject(dwChangeHandles,INFINITE);
     
    if ( FindNextChangeNotification(dwChangeHandles) == FALSE ) 
    ExitProcess(GetLastError()); 
    else
    {
    //判断是否你所要监视的文件,是否被改动过。
    //如果被改动过,则记录下这次改动。例如:计数器加一(i++)
    }}