【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 单独的命令或函数 ...
随机推荐
- Redis安装和使用
新年伊始,万象更新.祝大家:新的一年,工作顺利,生活越来越美好. http://www.redis.cn/commands.html http://try.redis.io/ http://www.c ...
- 2013长沙赛区现场赛 J - Josephina and RPG
J - Josephina and RPG Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I6 ...
- 关于COOKIE学习的一二
index.php <?php setcookie("name","dalisng",time()+3600); setcookie("addr ...
- PHP get_class 返回对象的类名
get_class (PHP 4, PHP 5) get_class — 返回对象的类名 说明 string get_class ([ object $obj ] ) 返回对象实例 obj 所属类的名 ...
- tcp三次握手与四次挥手
- LazyLoad.js及scrollLoading.js
http://blog.csdn.net/ning109314/article/details/7042829 目前图片延迟加载主要分两大块,一是触发加载(根据滚动条位置加载图片):二是自动预加载(加 ...
- iOS使用webView 加载网页,在模拟器中没有问题,而真机却白屏了。App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist f
还在info.plist中配置.除了配置允许上网的配置之外,还有另一项.
- 如何使用coding.net
由于我有一位十分聪明能干的室友会使用coding.net,于是我决定奉献一下室友的智慧,告诉大家如何使用conding.net上交作业.(如有说错的地方希望大家可以指出来) 首先登陆codin ...
- linux各文件夹的作用
文章转载自:http://www.cnblogs.com/amboyna/archive/2008/02/16/1070474.html 精------------------------------ ...
- CCF 模拟B 无脑循环+输入输出外挂
http://115.28.138.223:81/view.page?opid=2#code 代码一有WA点80分 #include<iostream> #include<cstdi ...