Home |
Function RTFSetDefaultOpenFlags Function RTFSetCriticalErrorHandler |
Function RTFSetDefaultOpenFlagsRTFSetDefaultOpenFlags can be used to define flags to be applied to all subsequent calls to RTFOpen: int RTFSetDefaultOpenFlags(DWORD GlobalFlags, DWORD LocalFlags); ParametersGlobalFlags and LocalFlagsCan be any combination of flags specified for RTFOpen. GlobalFlags are ored into the Flags parameter of all subsequent RTFOpen calls. LocalFlags are only applied to RTFOpen calls from the task calling RTFSetDefaultOpenFlags. In a single-threaded environment, both flags are always ored into the Flags parameter. return valueIf RTFSetDefaultOpenFlags succeeds, the return value is RTF_NO_ERROR. If the function fails, the return value is a negative error code. RTFSetDefaultOpenFlags is useful for two purposes: globally changing open flags which affect caching/committing (e.g., RTF_COMMITTED, RTF_CACHE_DATA, RTF_LAZY_DATA) or to set flags for indirect calls to RTFOpen, such as through an emulated API. For example, ANSI C function fopen() does not support opening a committed file, but the same effect can be achieved with: RTFSetDefaultOpenFlags(0, RTF_COMMITTED); f = fopen("somefile.txt", "w"); RTFSetDefaultOpenFlags(0, 0); Another use could be to protect directories from being opened accidentally: RTFSetDefaultOpenFlags(RTF_OPEN_NO_DIR, 0); If you want to explicitly open a directory, specify RTF_OPEN_DIR to override RTF_OPEN_NO_DIR: f = RTFOpen("c:\\adir", RTF_READ_ONLY | RTF_OPEN_DIR); Function RTFSetCriticalErrorHandler
|