xlDefineBinaryName

Used to allocate persistent storage for a bigdata XLOPER. Data with a defined binary name is saved with the workbook, and can be accessed by name at any time.

Syntax

Excel4(xlDefineBinaryName, 0, 2, LPXLOPER pxName, LPXLOPER pxData);

pxName

String XLOPER specifying the name of the data.

pxData

Bigdata XLOPER specifying the data. When you call this function, the lpbData member of the bigdata structure should point to the data for which the name is being defined, and the cbData member should contain the length of the data in bytes.

If the pxData argument is not specified (xltypeMissing), the named allocation specified by pxName is deleted.

Example

This example accepts a name, a pointer to data, and the length of the data. It uses the xlDefineBinaryName function to allocate memory for the data, and returns the result of the Excel4 function (success or failure).

int WINAPI xlDefineBinaryNameExample(LPSTR lpszName,
    LPBYTE lpbData, long cbData)
{
    char stBuf[255];
    XLOPER xName, xData;

    lstrcpy(stBuf + 1, lpszName);
    stBuf[0] = lstrlen(lpszName);

    xName.xltype = xltypeStr;
    xName.val.str = stBuf;

    xData.xltype = xltypeBigData;
    xData.val.bigdata.h.lpbData = lpbData;
    xData.val.bigdata.cbData = cbData;

    return Excel4(xlDefineBinaryName, 0, 2, (LPXLOPER)&xName,
        (LPXLOPER)&xData);
}

Related Function

xlGetBinaryName