Ver Mensaje Individual
  #1  
Antiguo 03-07-2007
JuanErasmo JuanErasmo is offline
Miembro
 
Registrado: ago 2005
Posts: 544
Reputación: 19
JuanErasmo Va por buen camino
Porque WaitForMultipleObjects bloquea mi aplicacion y otras funciones?

hola amigos, estoy intentando monitorear el cambio de una carpeta , es decir, que me genere un evento al crear una carpeta nueva....ya tengo la funcion, el problema es que me bloquea la aplicacion misma, y algunas otras funciones de windows.....
el codigo es este,,,
Código:
HANDLE   dwChangeHandles[2];
      dwChangeHandles[0]   =   FindFirstChangeNotification(
          "C:\\contar",
          FALSE,
          FILE_NOTIFY_CHANGE_FILE_NAME);
      if   (dwChangeHandles[0]   ==   INVALID_HANDLE_VALUE)
          ExitProcess(GetLastError());
      dwChangeHandles[1]   =   FindFirstChangeNotification(
          "C:\\contar",
          TRUE,
          FILE_NOTIFY_CHANGE_DIR_NAME);
      if(dwChangeHandles[1]   ==   INVALID_HANDLE_VALUE)
          ExitProcess(GetLastError());
      while   (TRUE)
      {
          if(WaitForMultipleObjects(2,   dwChangeHandles,
                  FALSE,   INFINITE)!=WAIT_OBJECT_0)break;
          ShowMessage("Cambio!   ");
          if(FindNextChangeNotification(dwChangeHandles[0])   ==   FALSE)//????
                  break;
          if   (FindNextChangeNotification(dwChangeHandles[1])   ==   FALSE)
                  break;
      }
      Memo1->Lines->Add(WaitForMultipleObjects(2,   dwChangeHandles,
                  FALSE,   INFINITE)) ;
      ShowMessage("end");       // Muestra esto cuando se crea o se elimina una carpeta.
Que puedo hacer para que funcione "normalmente" ?
Gracias
Responder Con Cita