Question

I'm used this example for build XLL for Excel using C++. I'm created own function which take 2 double args and return string:

 __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;
}

Function definition:

{
              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       
       },

If P = 100,345 T = 200,567 I'm getting P = 2061584302 and T = -584115552 in output - I've used debugPrintf function. When function args is long:

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

and function signature "UJJ" I try P = 100,345 T = 200,567 I'm getting P=100 and T = 201.

So, which right function signature I must use?

Was it helpful?

Solution 2

Right way - use breakpoints to view variables values.

OTHER TIPS

Looks like the comma is being interpreted as a decimal point.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top