Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Система";
Текущий архив: 2002.10.24;
Скачать: [xml.tar.bz2];

Вниз

Работа с системой   Найти похожие ветки 

 
Dmitriy_K   (2002-08-16 08:49) [0]

Как писать реакцию на системные события:
- попытка записи на определенный диск;
- попытка чтения с определенного диска;
- попытка записи файла определенного типа;
- попытка снятия приложения нажатием горячих клавиш?
Можно ли получить при резидентной работе программы текст выполняемых системой команд DOS?
Буду очень благодарен за помощь.
Дима.


 
Севостьянов Игорь   (2002-08-16 13:08) [1]

Может это и не совсем то, но вот смотри сам

- попытка записи на определенный диск;
- попытка чтения с определенного диска;
- попытка записи файла определенного типа;


Насчет типа файла (проверяй когда файл изменяется ужо и его тип)

FindFirstChangeNotification
The FindFirstChangeNotification function creates a change notification handle and sets up initial change notification filter conditions. A wait on a notification handle succeeds when a change matching the filter conditions occurs in the specified directory or subtree.

HANDLE FindFirstChangeNotification(
LPCTSTR lpPathName, // directory name
BOOL bWatchSubtree, // monitoring option
DWORD dwNotifyFilter // filter conditions
);
Parameters
lpPathName
[in] Pointer to a null-terminated string that specifies the path of the directory to watch.
Windows NT/2000: In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to nearly 32,000 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see File Name Conventions.

Windows 95/98: This string must not exceed MAX_PATH characters.

bWatchSubtree
[in] Specifies whether the function will monitor the directory or the directory tree. If this parameter is TRUE, the function monitors the directory tree rooted at the specified directory; if it is FALSE, it monitors only the specified directory.
dwNotifyFilter
[in] Specifies the filter conditions that satisfy a change notification wait. This parameter can be one or more of the following values. Value Meaning
FILE_NOTIFY_CHANGE_FILE_NAME Any file name change in the watched directory or subtree causes a change notification wait operation to return. Changes include renaming, creating, or deleting a file name.
FILE_NOTIFY_CHANGE_DIR_NAME Any directory-name change in the watched directory or subtree causes a change notification wait operation to return. Changes include creating or deleting a directory.
FILE_NOTIFY_CHANGE_ATTRIBUTES Any attribute change in the watched directory or subtree causes a change notification wait operation to return.
FILE_NOTIFY_CHANGE_SIZE Any file-size change in the watched directory or subtree causes a change notification wait operation to return. The operating system detects a change in file size only when the file is written to the disk. For operating systems that use extensive caching, detection occurs only when the cache is sufficiently flushed.
FILE_NOTIFY_CHANGE_LAST_WRITE Any change to the last write-time of files in the watched directory or subtree causes a change notification wait operation to return. The operating system detects a change to the last write-time only when the file is written to the disk. For operating systems that use extensive caching, detection occurs only when the cache is sufficiently flushed.
FILE_NOTIFY_CHANGE_SECURITY Any security-descriptor change in the watched directory or subtree causes a change notification wait operation to return.


Return Values
If the function succeeds, the return value is a handle to a find change notification object.

If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.

Remarks
The wait functions can monitor the specified directory or subtree by using the handle returned by the FindFirstChangeNotification function. A wait is satisfied when one of the filter conditions occurs in the monitored directory or subtree.

After the wait has been satisfied, the application can respond to this condition and continue monitoring the directory by calling the FindNextChangeNotification function and the appropriate wait function. When the handle is no longer needed, it can be closed by using the FindCloseChangeNotification function.

Requirements
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000.

See Also
File I/O Overview, File I/O Functions, FindCloseChangeNotification, FindNextChangeNotification



- попытка снятия приложения нажатием горячих клавиш?

отрабатывай сообщение Windows WM_QUIT (WM_QUERYENDSESSION) и при этом свой флаг (если нормальное закрытие то True иначе False - при FormCreate = False при Form.Close = True)


Можно ли получить при резидентной работе программы текст выполняемых системой команд DOS?

Возможно я и ощибаюсь, но вроде перехват Command Prompt StdOutput
как это сделать не знаю (или не помню)

На этом я и закончу свое объяснение



Страницы: 1 вся ветка

Форум: "Система";
Текущий архив: 2002.10.24;
Скачать: [xml.tar.bz2];

Наверх




Память: 0.46 MB
Время: 0.009 c
3-78252
Igor_
2002-10-02 11:47
2002.10.24
Скорость TIBQuery.Locate


14-78609
DiamondShark
2002-10-03 10:50
2002.10.24
Охренели


3-78211
AFrolov
2002-10-03 13:36
2002.10.24
Подскажите, как в ClientDataSet сделать табличку


4-78711
Aleksandr
2002-09-11 13:26
2002.10.24
Как работать с SHGetSpecialFolderLocation?


1-78355
X_Key
2002-10-14 20:43
2002.10.24
Прога с параметрами





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский