【XLL API 函数】 xlFree
用于释放使用 Excel4,Excel4v,Excel12,Excel12v 分配的 XLOPER/XLOPER12 占用的内存资源。 xlFree 函数释放辅助内存和重置指针为NULL但不释放XLOPER / XLOPER12的其他部分。
原型
Excel4(xlFree, 0, n, LPXLOPER px_1, ..., LPXLOPER px_n);
Excel12(xlFree, 0, n, LPXLOPER12 px_1, ..., LPXLOPER12 px_n);
参数
px_1, ..., px_n
一个或多个 XLOPER/XLOPER12 被释放。到 Excel 2003 为止,最大指针数量只能为30个。在Excel 2007 只能为 255。
属性值/返回值
这个函数不返回值
备注
你必需释放 XLOPER 和 XLOPER12 ,如果它们是 xltypeStr,xltypeMulti 或 xltypeRef 中的一种。它总是能安全的释放内存空间,即便你实际上没有使用内存,只要你是从 Excel4 或 Excel12 获取的这些数据。
你获取一个 XLOPER/XLOPER12 指针,它包含了Excel分配的内存,你就必需设置 xlbitXLFree 确保 Excel 释放这个内存资源。
实例
This example calls GET.WORKSPACE(1) to return the platform on which Excel is currently running as a string. The code copies this returned string into a buffer for later use. The code places the buffer back into the XLOPER12 for later use with the Excel function. Finally, the code displays the string in an alert box.
\SAMPLES\EXAMPLE\EXAMPLE.C
short WINAPI xlFreeExample(void)
{
XLOPER12 xRes, xInt;
XCHAR buffer[cchMaxStz];
int i,len;
// Create an XLOPER12 for the argument to Getworkspace.
xInt.xltype = xltypeInt;
xInt.val.w = 1;
// Call GetWorkspace.
Excel12f(xlfGetWorkspace, &xRes, 1, (LPXLOPER12)&xInt);
// Get the length of the returned string
len = (int)xRes.val.str[0];
//Take into account 1st char, which contains the length
//and the null terminator. Truncate if necessary to fit
//buffer.
if (len > cchMaxStz - 2)
len = cchMaxStz - 2;
// Copy to buffer.
for(i = 1; i <= len; i++)
buffer[i] = xRes.val.str[i];
// Null terminate, Not necessary but a good idea.
buffer[len] = '\0';
buffer[0] = len;
// Free the string returned from Excel.
Excel12f(xlFree, 0, 1, &xRes);
// Create a new string XLOPER12 for the alert.
xRes.xltype = xltypeStr;
xRes.val.str = buffer;
// Show the alert.
Excel12f(xlcAlert, 0, 1, (LPXLOPER12)&xRes);
return 1;
}
【XLL API 函数】 xlFree的更多相关文章
- 【XLL API 函数】xlAbort
C API 中有 15个 Excel 回调函数只能使用 Excel4.Excel4v.Excel12.Excel12v 函数调用(或间接的使用框架函数 Excel 或 Excel12f 调用).也就是 ...
- 【XLL API 函数】xlfUnregister (Form 1)
此函数可以被 Excel 已经载入的 XLL 或 DLL 调用.它等效于宏表函数 UNREGISTER. xlfUnregister 有两种调用形式: 形式1:Unregister 单独的命令或函数 ...
- 【XLL API 函数】xlSheetNm
从外部引用包含的工作表ID返回工作表或宏表名称,或是当前表名称. 原型 Excel12(xlSheetNm, LPXLOPER12 pxRes, 1, LPXLOPER12 pxExtref); 参数 ...
- 【XLL API 函数】xlSheetId
查找命名的工作表ID,用于外部引用. 原型 Excel12(xlSheetId, LPXLOPER12 pxRes, 1, LPXLOPER12 pxSheetName); 参数 pxSheetNam ...
- 【XLL API 函数】xlGetName
以字符串格式返回 DLL 文件的长文件名. 原型 Excel12(xlGetName, LPXLOPER12 pxRes, 0); 参数 这个函数没有参数 属性值和返回值 返回文件名和路径 实例 \S ...
- 【XLL API 函数】xlGetHwnd
返回顶层的 Excel 窗口句柄. Excel4(xlGetHwnd, LPXLOPER pxRes, 0); /* returns low part only */ Excel12(xlGetHwn ...
- 【XLL API 函数】xlGetBinaryName
用于返回由 xlDefineBinaryName 函数定义的名称数据句柄.定义的名称和工作簿一起保存,我们可以在任意时间访问这个名称. 原型 Excel12(xlGetBinaryName, LPXL ...
- 【XLL API 函数】xlCoerce
将 XLOPER/XLOPER12 转换为另一种类型,或是查询表格中的单元格值. 函数原型 Excel12(xlCoerce, LPXLOPER12 pxRes, 2, LPXLOPER12 pxSo ...
- 【XLL API 函数】xlfUnregister (Form 2)
此函数可以被 Excel 已经载入的 XLL 或 DLL 调用.它等效于宏表函数 UNREGISTER. xlfUnregister 有两种调用形式: 形式1:Unregister 单独的命令或函数 ...
随机推荐
- codevs2574 波兰表达式
题目描述 Description 对于 加.减.乘.除这种四则运算的表达式,我们使用的是先乘除.后加减的从左到右的顺序进行运算,如果要指定特定的顺序,就要增加括号进行表达,比如 (A+B)*C , A ...
- ImageView.ScaleType8种用法
1·ImageView.ScaleType.center:图片位于视图中间,但不执行缩放. 2·ImageView.ScaleType.CENTER_CROP 按统一比例缩放图片(保持图片的尺寸比例) ...
- session 的用法
</head> <body> <?php //session_start();//开启session,必须写在PHP代码最顶端 //HTTP,无状态性 //记录登陆者状态 ...
- STM32F10xx CAN BUS相关库文件"stm32f10x_can.c"内的库函数解析
一.背景: 还是继续CAN通信,要节省开发时间,使用库函数可大大降低开发周期,并且还能确保寄存器的配置几 乎是万无一失,所以,在此就STM32F10xx的CAN操作库函数的使用做个简析. STM32有 ...
- cf.301.D. Bad Luck Island(dp + probabilities)
D. Bad Luck Island time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- 虚拟机安装Ubuntu三种网络模式
VMWare提供三种工作模式桥接(bridge).NAT(网络地址转换)和host-only(主机模式). NAT(网络地址转换) 在NAT模式下,虚拟系统需要借助NAT(网络地址转换)功能,通过宿主 ...
- int (*p)[4] 与 int* p[4]
碰到一道题: ][] = {,,,,,,,,,,,}; ]; ] = (a+); cout<<*(p+)<<endl; cout<<(*ptr+)[]<< ...
- MySQL Python教程(3)
Class cursor.MySQLCursor 具体方法和属性如下:Constructor cursor.MySQLCursorMethod MySQLCursor.callproc(procnam ...
- python 环境安装
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz tar zxf Python-2.7.3.tgz cd Python-2. ...
- C++基础知识(2)---函数
c++中的函数和C语言中的函数相比,增加了许多新的语法与功能.在这里总结一下c++中常用的引用函数,函数重载和内联函数. 1 引用参数 引用参数最常用的一个例子就是 交换 两个数,如下 void s ...