Registers a file type for I/O type add-ons.

    GSErrCode  ACAPI_Register_FileType (
        Int32            refCon,
        GSType           ftype,
        GSType           fcreator,
        const char*      extname,
        short            iconResID,
        short            descStrResID,
        short            descStrResItemID,
        API_IOMethod     methodFlags



[in] An arbitrary number which identifies this file type within the add-on.
[in] Macintosh file type (e.g. ‘TEXT’).
[in] Creator on Macintosh (e.g. ‘GSAC’ for Archicad).
[in] The extension used on Windows (e.g. “txt”).
[in] An optional icon resource ID. This icon appears in the Open/Save dialogs on the Macintosh.
[in] The resource ID of the resource containing the description of the file type.
[in] The item ID within the resource of the item containing the description of the file type, or 0 when specifying MIME type as well (see Remarks).
[in] Flags describing the Open/Save dialogs to add this file type to (see Remarks).


Return Values

The function has completed with success.

For other common API errors see the API Errors document.



This function should be called from the RegisterInterface routine in your add-on. You can register more than one file type from the same add-on, appearing in different menus of the server application.

The supplied refCon parameter should be the same in the ACAPI_Install_FileTypeHandler function, which you have to call from your Initialize routine.

The methodFlags parameter defines which dialogs’ file type popup should contain the registered file type:

Flag File Dialog
Open2DSupported Open as 2D
Merge2DSupported Merge
OpenLibPartSupported Open Library Item
SaveAs2DSupported Save as 2D
SaveAs3DSupported Save as 3D
SaveAsFlySupported Create Fly-Through/Sun Study
Import2DDrawingSupported  Featuring API 10 Import as Drawing


4.2  From API v4.2 you have the possibility to register the MIME type for the file as well. MIME (Multipurpose Internet Mail Extension) types are commonly accepted identifiers for certain media types. Specifying the MIME type makes the file format identification more accurate in the File Type Manager.
If you decide to use this feature, you can do this in the following way:

  • in the GRC file the string resource that describes the file format must contain two items:
    1. the descriptive name of the file format (e.g. “DWF File”)
    2. the assigned MIME type (e.g. “model/vnd.dwf”)
  • in the descStrResItemID parameter of the ACAPI_Register_FileType function you must pass 0



In the localizable GRC file:

'STR#' 32500    "File Type descriptions" {
/* [  1] */         "DWF File"
/* [  2] */         "model/vnd.dwf"

In the RegisterInterface function:

// Interface definitions
GSErrCode    __ACENV_CALL   RegisterInterface (void)
    GSErrCode err;

    err = ACAPI_Register_FileType (1, 'GSAC', ' DWF', "dwf", 0, 32500, 0,
                                   SaveAs2DSupported + Open2DSupported + Merge2DSupported + Import2DDrawingSupported);

    return err;
}   // RegisterInterface



Version: API 4.1 or later
Header: ACAPinc.h


See Also

API Functions