c++ - XLL 函数参数签名类型

标签 c++ excel arguments add-in xll

我习惯了this使用 C++ 为 Excel 构建 XLL 的示例。 我创建了自己的函数,它接受 2 个双参数并返回字符串:

 __declspec(dllexport) LPXLOPER12 WINAPI PTstate (double P, double T)
{
       static XLOPER12 xResult;
       xResult.xltype = xltypeStr;  
       debugPrintf("P = %d\n", P);
       debugPrintf("T = %d\n", T);
      Calculate(P, T);
      xResult.val.str = L"\013Calculated";
      return(LPXLOPER12) &xResult;
}

函数定义:

{
              L"PTstate",                 // Function name/ordinal
              L"UBB",                    // Func signature type **U - XLOPER12, BB - P and T double**
              L"PTstate",                 // Func name in Func wizard
              L"P, T",             // Arg name in Func wizard
              L"1",                      // Function type
              L"SimpleXll2007",           // Category in Func wizard
              L"",                       // Shortcut (commands only)
              L"",                       // Help topic
              L"",  // Func help in Func wizard
              L"",          // Arg help in Func wizard
              L""           // Arg help in Func wizard       
       },

如果 P = 100,345 T = 200,567 我在输出中得到 P = 2061584302 和 T = -584115552 - 我使用了 debugPrintf 函数。 当函数参数很长时:

__declspec(dllexport) LPXLOPER12 WINAPI PTstate (long P, long T)

和函数签名“UJJ”我尝试 P = 100,345 T = 200,567 我得到 P=100 和 T = 201。

那么,我必须使用哪个正确的函数签名?

最佳答案

看起来逗号被解释为小数点。

关于c++ - XLL 函数参数签名类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17546579/

相关文章:

c++ - 从 Object<const T> 转换为 Object<t>

java - Assets 文件目录给出 java.io.FileNotFoundException eclipse

c - 如何使用另一个函数的参数调用一个函数?

c++ - const_casting 可变字段安全吗?

c++ - 从像素获取 RGB 值并将 RGB 值设置回同一像素

excel - 用于 Angular 2 Excel 导出日期格式的 Kendo Grid

excel - 将数据从一个 AWS 复制到另一个 AWS,并根据第一个工作表添加 3 个新列

c - 我如何在 C 编程的 mkdir 函数中传递像 ("~/test/foo"这样的字符串文字?

c++ - 运算符++ 中的 Int 参数

c++ - Linux下如何将显示输出传到串口?