用于释放使用 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。

属性值/返回值

这个函数不返回值

备注

你必需释放 XLOPERXLOPER12 ,如果它们是 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的更多相关文章

  1. 【XLL API 函数】xlAbort

    C API 中有 15个 Excel 回调函数只能使用 Excel4.Excel4v.Excel12.Excel12v 函数调用(或间接的使用框架函数 Excel 或 Excel12f 调用).也就是 ...

  2. 【XLL API 函数】xlfUnregister (Form 1)

    此函数可以被 Excel 已经载入的 XLL 或 DLL 调用.它等效于宏表函数 UNREGISTER. xlfUnregister 有两种调用形式: 形式1:Unregister 单独的命令或函数 ...

  3. 【XLL API 函数】xlSheetNm

    从外部引用包含的工作表ID返回工作表或宏表名称,或是当前表名称. 原型 Excel12(xlSheetNm, LPXLOPER12 pxRes, 1, LPXLOPER12 pxExtref); 参数 ...

  4. 【XLL API 函数】xlSheetId

    查找命名的工作表ID,用于外部引用. 原型 Excel12(xlSheetId, LPXLOPER12 pxRes, 1, LPXLOPER12 pxSheetName); 参数 pxSheetNam ...

  5. 【XLL API 函数】xlGetName

    以字符串格式返回 DLL 文件的长文件名. 原型 Excel12(xlGetName, LPXLOPER12 pxRes, 0); 参数 这个函数没有参数 属性值和返回值 返回文件名和路径 实例 \S ...

  6. 【XLL API 函数】xlGetHwnd

    返回顶层的 Excel 窗口句柄. Excel4(xlGetHwnd, LPXLOPER pxRes, 0); /* returns low part only */ Excel12(xlGetHwn ...

  7. 【XLL API 函数】xlGetBinaryName

    用于返回由 xlDefineBinaryName 函数定义的名称数据句柄.定义的名称和工作簿一起保存,我们可以在任意时间访问这个名称. 原型 Excel12(xlGetBinaryName, LPXL ...

  8. 【XLL API 函数】xlCoerce

    将 XLOPER/XLOPER12 转换为另一种类型,或是查询表格中的单元格值. 函数原型 Excel12(xlCoerce, LPXLOPER12 pxRes, 2, LPXLOPER12 pxSo ...

  9. 【XLL API 函数】xlfUnregister (Form 2)

    此函数可以被 Excel 已经载入的 XLL 或 DLL 调用.它等效于宏表函数 UNREGISTER. xlfUnregister 有两种调用形式: 形式1:Unregister 单独的命令或函数 ...

随机推荐

  1. 【Solr】索引库查询界面详解

    目录 索引库查询界面详解 回到顶部 索引库查询界面详解 q:主查询条件.完全支持lucene语法.还进行了扩展. fq:过滤查询.是在主查询条件查询结果的基础上进行过滤.例如:product_pric ...

  2. soj4271 Love Me, Love My Permutation (DFS)

    4271: Love Me, Love My Permutation Description Given a permutation of n: a[0], a[1] ... a[n-1], ( it ...

  3. Logistic 回归(sigmoid函数,手机的评价,梯度上升,批处理梯度,随机梯度,从疝气病症预测病马的死亡率

    (手机的颜色,大小,用户体验来加权统计总体的值)极大似然估计MLE 1.Logistic回归 Logistic regression (逻辑回归),是一种分类方法,用于二分类问题(即输出只有两种).如 ...

  4. 【血的教训】玩 Ubuntu 遇到的致命问题(进不了系统)及 解决方案

    [问题1] 按照文章“U盘安装Windows 7 + Ubuntu 14 双系统笔记”在 Windows 7 基础上安装了 Ubuntu 14 系统,实现双系统切换,某一天, 通过如下命令行 sudo ...

  5. 索 COM 类工厂中 CLSID 为{00024500-0000-0000-C000-000000000046} 的组件时失败,原因是出现以下错误: 80070005。

    具体解决方法如下: 1:在服务器上安装office的Excel软件. 2:在"开始"->"运行"中输入dcomcnfg.exe启动"组件服务&q ...

  6. lvs部署-DR模式

    DR模式 角色 IP地址 备注 LVS负载均衡器 192.168.119.132 VIP:192.168.119.150    ipvsadm http_Real server 192.168.119 ...

  7. Redis学习笔记八:独立功能之二进制位数组

    Redis 提供了 setbit.getbit.bitcount.bitop 四个命令用于处理二进制位数组. setbit 命令用于为位数组指定偏移量上的二进制位设置值,偏移量从 0 开始计数. ge ...

  8. Android中加载位图的方法

    Android中加载位图的关键的代码: AssetManager assets =context.getAssets(); //用一个AssetManager 对象来从应用程序包的已编译资源中为工程加 ...

  9. 2016移动端web5分钟速成(适合新手)

    http://www.w3cfuns.com/notes/20813/fecbb840a2574cf712a8625f88a7ab3a.html

  10. Windows8笔记

    一.WIN8 硬盘变为可弹出设备 如果电脑使用的是nforce芯片组的主板和串口硬盘.在系统中安装好所有的硬件驱动程序后,会出现这种情况.这是nforce芯片组在安装了IDE-SW主板驱动以后,系统会 ...