DoIdentifyFile
A file translation extension must respond to the kTranslateIdentifyFile request code. The Translation Manager uses this request code to allow the translation extension to identify a file as having a format that the extension can translate. You can handle this request by calling the CallComponentFunctionWithStorage function and passing it a pointer to a function with the syntax defined by the DoIdentifyFile function.
FUNCTION DoIdentifyFile (self: ComponentInstance;
theDoc: FSSpec;
VAR docKind: FileType)
: ComponentResult;
self
- A component instance that identifies the component containing the translation extension.
theDoc
- A file system specification record that specifies the document that the translation extension must identify.
docKind
- On exit, the file format type of the document as identified by your translation extension.
DESCRIPTION
Your DoIdentifyFile function returns, through the docKind parameter, the file type of the file specified by the FSSpec record passed in the theDoc parameter. If your translation extension does not recognize the type of the specified file, DoIdentifyFile should return the result code noTypeErr.
SPECIAL CONSIDERATIONS
Your DoIdentifyFile function should not return 'TEXT' as a file type unless you determine that the document consists solely of a plain, unformatted stream of ASCII characters.
RESULT CODES
| noErr | 0 | No error |
| noTypeErr | -102 | Unrecognized file type |