zoukankan      html  css  js  c++  java
  • 【XLL API 函数】xlfUnregister (Form 1)

    此函数可以被 Excel 已经载入的 XLL 或 DLL 调用。它等效于宏表函数 UNREGISTER。

    xlfUnregister 有两种调用形式:

    • 形式1:Unregister 单独的命令或函数
    • 形式2:卸载 和 去激活 XLL

    之前使用 xlfRegister 或 REGISTER 函数时,会进函数调用次数进行计数,使用此函数可以减少计数。如果计数器已经为0,调用这个函数将不会产生任何效果。当使用DLL中所有的函数调用计数器都为0,DLL 将会从内存中卸载。

    xlfRegister (Form 1) 还定义了一个隐藏的名字做为函数的文本参数,pxFunctionText,此参数会评估函数的或命令的注册ID。当反注册函数,此名称将使用 xlfSetName 删除。因此函数名称不会再次在 Function Wizard 中显示出来。

    Excel4(xlfUnregister, LPXLOPER pxRes, 1, LPXLOPER pxRegisterId);
    

    参数

    pxRegisterId(xltypeNum)

    这表示在反注册的函数注册ID

    属性值和返回值

    如果成功,返回 TRUE (xltypeBool),反之返回 FALSE

    备注

    函数注册ID由 xlfRegister 第函数第一次注册时返回。它也可以通过调用 xlfRegisterIdxlfEvaluate 函数返回。注意,如果函数没有注册的话,使用 xlfRegisterId 会将函数进行注册。正是由于这个原因,如果你只是想获取ID的而不注册函数的话,最好是将函数名作为 xlfEvaluate 参数进行处理。

    实例

    查看 SAMPLESGENERICGENERIC.C.
    中的 fExit 函数

    [C++]
    int WINAPI fExit(void)
    {
       XLOPER12  xDLL,    // The name of this DLL //
       xFunc,             // The name of the function //
       xRegId;            // The registration ID //
       int i;
    
    //
    // This code gets the DLL name. It then uses this along with information
    // from g_rgFuncs[] to obtain a REGISTER.ID() for each function. The
    // register ID is then used to unregister each function. Then the code
    // frees the DLL name and calls xlAutoClose.
    //
    
       // Make xFunc a string //
       xFunc.xltype = xltypeStr;
    
       Excel12f(xlGetName, &xDLL, 0);
    
       for (i = 0; i < g_rgWorksheetFuncsRows; i++)
       {
          xFunc.val.str = (LPWSTR) (g_rgWorksheetFuncs[i][0]);
          Excel12f(xlfRegisterId,&xRegId,2,(LPXLOPER12)&xDLL,(LPXLOPER12)&xFunc);
          Excel12f(xlfUnregister, 0, 1, (LPXLOPER12) &xRegId);
       }
    
       for (i = 0; i < g_rgCommandFuncsRows; i++)
       {
          xFunc.val.str = (LPWSTR) (g_rgCommandFuncs[i][0]);
          Excel12f(xlfRegisterId,&xRegId,2,(LPXLOPER12)&xDLL,(LPXLOPER12)&xFunc);
          Excel12f(xlfUnregister, 0, 1, (LPXLOPER12) &xRegId);
       }
    
       Excel12f(xlFree, 0, 1,  (LPXLOPER12) &xDLL);
    
       return xlAutoClose();
    }
    
  • 相关阅读:
    python day6
    python day5
    python基础晋级篇
    python基础篇
    初识Python
    if语句
    A22. openstack架构实战-openstack的api
    A21. openstack架构实战-配置三层网络vxlan
    A20. openstack架构实战-虚拟机创建的流程
    A19. openstack架构实战-云主机的冷迁移
  • 原文地址:https://www.cnblogs.com/boluoke/p/5944791.html
Copyright © 2011-2022 走看看