3

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

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

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

你知道是否有任何可用的文件吗?显然,要到达那里并不容易。

4

2 回答 2

0

没有针对所有 C API XLM 函数的详尽官方文档。但是,正如文档所述,关于 C API XLM 函数的内容如下:

Excel 通过 C API 公开了更多功能,这些功能在您开发 XLL 时很有用。它们对应于 Excel 工作表函数以及 XLM 宏表中可用的函数和命令。”

此外,EXAMPLE.[C,H]SDK 安装附带的文件使用了其中的一些功能,您可以使用它来学习如何使用它们。例如,xlfAddMenuxlAutoOpen回调函数中使用。

// 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);
}
于 2014-01-31T08:37:37.357 回答
0

根据我的说法,最好的文档(但未更新..)是以下书:Steve Dalton 编写的 C/C++ 中使用 Excel 插件开发的金融应用程序,第二版。您可以在第 332 页找到有关 xlfAddMenu 功能的说明。您还可以在 Microsoft Excel XLL 软件开发工具包的 chm 文件中找到一些有用的信息,包括代码示例(注意我没有在其中找到 xlfAddMenu,所以我猜它是折旧功能)。

于 2015-11-14T02:14:13.863 回答