Есть вот такая функц
Код:
#include <conio.h>
#include <iostream>
#include <string>
using namespace std;
DWORD WINAPI MonitoringThread(void * pParam);
static bool g_bGoOn = true;
int main(int argc, char* argv[])
{
cout << "Link zum monitoring eingeben : ";
string sDir;
cin >> sDir;
DWORD dwID;
::CreateThread(NULL, 0, MonitoringThread, (void *)sDir.c_str(), 0, &dwID);
char ch;
while (ch = getch())
{
if ('q' == ch || 'Q' == ch)
break;
}
g_bGoOn = false;
Sleep(300);
return 0;
}
DWORD WINAPI MonitoringThread(void * pParam)
{
const char * pszDir = (char *) pParam;
HANDLE hMonitor = ::FindFirstChangeNotification(pszDir, false, FILE_NOTIFY_CHANGE_LAST_WRITE);
//everything worked wrong
if (INVALID_HANDLE_VALUE == hMonitor)
ExitProcess(-1);
///
cout << "Started monitoring " << pszDir << " directory." << endl;
DWORD dw;
while (g_bGoOn)
{
dw = ::WaitForSingleObject(hMonitor, 1000);
switch (dw)
{
case WAIT_TIMEOUT:
//time out and nothing has changed
break;
case WAIT_OBJECT_0:
//we have changes in the monitored directory
::FindNextChangeNotification(hMonitor);
cout << "In the monitored directory change(s) have occured!" << endl;
break;
default:
//means there's some other error
cout << "Error has occured. Monitoring has stopped. Press 'q' to quit" <<
endl;
g_bGoOn = false;
break;
}
}
//close the search
::FindCloseChangeNotification(hMonitor);
return 0;
}
проверика дериктории, нужно зделать так что бы не в дос окне а виндовс окне появлялось текстовое сообщение - "New Files" или что то в етом роде. Если нетрудно подскажите как ето осуществить.
Спасибо