Probléme pour récuperer le nom du Fichier API Windows
Bonjour,
j'ai créé une fonction de monitoring de répertoire, tous compile bien, elle marche.
Mais j'aurai besoin de récupérer le nom du fichier qui a était créé et je ne c'est absolument pas comment faire.
Voici mon code :
Code:
1 2 3 4 5
| void RefreshDirectory(LPTSTR lpDir)
{
_tprintf(TEXT("Directory (%s) changed.\n"), lpDir);
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| DWORD dwWaitStatus;
HANDLE dwChangeHandles[2];
dwChangeHandles[0] = FindFirstChangeNotification(
"D:\\Documents and Settings\\A159754\\Bureau\\serveur\\rapport",
FALSE,
FILE_NOTIFY_CHANGE_FILE_NAME);
if (dwChangeHandles[0] == INVALID_HANDLE_VALUE)
ExitProcess(GetLastError());
dwChangeHandles[1] = FindFirstChangeNotification(
"D:\\Documents and Settings\\A159754\\Bureau\\serveur\\rapport",
TRUE,
FILE_NOTIFY_CHANGE_DIR_NAME);
if (dwChangeHandles[1] == INVALID_HANDLE_VALUE)
ExitProcess(GetLastError());
while (TRUE)
{
dwWaitStatus = WaitForMultipleObjects(2, dwChangeHandles,
FALSE, INFINITE);
switch (dwWaitStatus)
{
case WAIT_OBJECT_0:
RefreshDirectory("D:\\Documents and Settings\\A159754\\Bureau\\serveur\\rapport");
if ( FindNextChangeNotification(
dwChangeHandles[0]) == FALSE )
ExitProcess(GetLastError());
cout<< "coucou4";
break;
case WAIT_OBJECT_0 + 1:
RefreshTree("D:\\Documents and Settings\\A159754\\Bureau\\serveur\\rapport");
if (FindNextChangeNotification(
dwChangeHandles[1]) == FALSE)
ExitProcess(GetLastError());
break;
default:
ExitProcess(GetLastError());
}
} |
Si vous avez une idée ou une solution je suis preneur.
Cordialement