zoukankan      html  css  js  c++  java
  • 【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。

    属性值/返回值

    这个函数不返回值

    备注

    你必需释放 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.

    SAMPLESEXAMPLEEXAMPLE.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] = '';
       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;
    }
    
  • 相关阅读:
    IBM X3650 M4服务器安装centos找不到硬盘的解决方法
    页面头部title、description、keywords标签的优化
    SEO优化之Title 和 Meta 标签
    WPA字典锦集
    PIN码计算锦集
    神经网络入门 第6章 识别手写字体
    神经网络入门 第5章 实现多层神经网络BP算法
    神经网络入门 第4章 神经网络可以模拟任意函数
    神经网络入门 第3章 S函数
    神经网络入门 第2章 编写第一个神经元
  • 原文地址:https://www.cnblogs.com/boluoke/p/5967328.html
Copyright © 2011-2022 走看看