Microsoft DirectX 9.0

IDirectXFile::RegisterTemplates Method

Registers custom templates.


HRESULT RegisterTemplates(      

    LPVOID pvData,     DWORD cbSize );


[in] Pointer to a buffer consisting of a Microsoft?DirectX?file in text or binary format that contains templates.
[in] Size of the buffer pointed to by pvData, in bytes.

Return Value

If the method succeeds, the return value is DXFILE_OK.

If the method fails, the return value can be one of the following values.

DXFILEERR_BADFILEFLOATSIZEFloating-point size is invalid.
DXFILEERR_BADFILETYPEFile is not a DirectX (.x) file.
DXFILEERR_BADFILEVERSIONFile version is not valid.
DXFILEERR_BADVALUEParameter is invalid.
DXFILEERR_PARSEERRORFile could not be parsed.


The following code fragment provides an example call to RegisterTemplates and example contents for the buffer to which pvData points.

TIDirectXFile * pDXFile;
char *szTemplates = "xof 0303txt 0032\
    template SimpleData { \
        <2b934580-9e9a-11cf-ab39-0020af71e433> \
        DWORD item1;DWORD item2;DWORD item3;} \
    template ArrayData { \
        <2b934581-9e9a-11cf-ab39-0020af71e433> \
        DWORD cItems; array DWORD aItem[2][cItems]; [...] } \
    template RestrictedData { \
        <2b934582-9e9a-11cf-ab39-0020af71e433> \
        DWORD item; [SimpleData]}";
hr = pDXFile->RegisterTemplates(szTemplates, strlen(szTemplates));

All templates must specify a name and a Universally Unique Identifier (UUID).

© 2002 Microsoft Corporation. All rights reserved.