1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
FileSystemWatcher _FileSystemWatcher = new FileSystemWatcher();
_FileSystemWatcher.Path = @"C:\Windows\system32\spool\PRINTERS";
_FileSystemWatcher.NotifyFilter = NotifyFilters.DirectoryName | NotifyFilters.FileName | NotifyFilters.Attributes;
_FileSystemWatcher.IncludeSubdirectories = true;
_FileSystemWatcher.Created += new FileSystemEventHandler(EventRaised);
try
{
_FileSystemWatcher.EnableRaisingEvents = true;
}
catch (ArgumentException ex)
{
throw new ArgumentException(ex.Message, ex);
}
private void EventRaised(object sender, FileSystemEventArgs e)
{
Le code WMI
} |
Partager