c - 缺少开发 xll 插件的 MSDN 文档?

标签 c excel msdn xll xlm

我花了相当多的时间寻找所有 C API XLM 函数的完整文档,但没有成功。

我发现这个页面说明了其中的一些: http://msdn.microsoft.com/en-us/library/office/bb687910%28v=office.12%29.aspx

但例如我想了解和使用 xlfAddMenu,但我在 MSDN 上找不到解释我的页面。

您知道是否有可用的文档吗?显然要到达那里并不那么容易。

最佳答案

没有针对所有 C API XLM 函数的详尽官方文档。然而,正如documentation有关 C API XLM 函数的说明如下:

Many more functions are exposed by Excel via the C API that are useful when you are developing XLLs. They correspond to the Excel worksheet functions and functions and commands that are available from XLM macro sheets."

此外,安装 SDK 时附带的 EXAMPLE.[C,H] 文件使用了其中一些函数,您可以通过它来了解如何使用它们。例如,xlfAddMenu 用于 xlAutoOpen 回调函数。

// In the following block of code, the Generic drop-down menu is created.
// Before creation, a check is made to determine if Generic already
// exists. If not, it is added. If the menu needs to be added, memory is
// allocated to hold the array of menu items. The g_rgMenu[] table is then
// transferred into the newly created array. The array is passed as an
// argument to xlfAddMenu to actually add the drop-down menu before the
// help menu. As a last step the memory allocated for the array is
// released.
//
// This block uses TempStr12() and TempNum12(). Both create a temporary
// XLOPER12. The XLOPER12 created by TempStr12() contains the string passed to
// it. The XLOPER12 created by TempNum12() contains the number passed to it.
// The Excel12f() function frees the allocated temporary memory. Both
// functions are part of the framework library.

Excel12f(xlfGetBar, &xTest, 3, TempInt12(10), TempStr12(L"Generic"), TempInt12(0));

if (xTest.xltype == xltypeErr)
{
    hMenu = GlobalAlloc(GMEM_MOVEABLE,sizeof(XLOPER12) * g_rgMenuCols * g_rgMenuRows);
    px = pxMenu = (LPXLOPER12) GlobalLock(hMenu);

    for (i=0; i < g_rgMenuRows; i++)
    {
        for (j=0; j < g_rgMenuCols; j++)
        {
            px->xltype = xltypeStr;
            px->val.str = TempStr12(g_rgMenu[i][j])->val.str;
            px++;
        }
    }

    xMenu.xltype = xltypeMulti;
    xMenu.val.array.lparray = pxMenu;
    xMenu.val.array.rows = g_rgMenuRows;
    xMenu.val.array.columns = g_rgMenuCols;

    Excel12f(xlfAddMenu,0,3,TempNum12(10),(LPXLOPER12)&xMenu,TempStr12(L"Help"));

    GlobalUnlock(hMenu);
    GlobalFree(hMenu);
}

关于c - 缺少开发 xll 插件的 MSDN 文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17175203/

相关文章:

c - lua中的简单加密

c - 如何使用 ALSA 在缓冲区中录制声音

c++ - 从文件读取并将值放入结构数组时遇到问题

ios - 在 Swift 中使用 C API

c# - 在 C# 中安全地处理 Excel 互操作对象?

uwp - 如何从 2D Windows 通用应用程序访问全息空间?

excel - 从多个连接构建可刷新查询 AS400 IBMi

sql - 每天自动将数据从 Excel 导入 PostgreSQL

c - 从 C 代码生成程序的多个副本并将输出重定向到文件

azure - 将 Azure 订阅与 MSDN 订阅合并