1

I am kind of confused, I was following the "Excel 2013 SDK" documentation, and bein interested in User defined Asynchronous functions. Here is my simplest example, it doesn't even do anything:

// registration
    { L"Func5",                                 // Procedure
        L">QX",                                 // void return >; 
        L"Func5",                               // function_text; The function name as it will appear in the Function Wizard
        L"Arg",                                 // argument_text; The user sees this in the Function 
        L"1",                                   // macro_type; "1" can be called from anywhere; listed everywhere
        L"Generic Add-In",                      // category
        L"",                                    // shortcut_text; A one-character, case-sensitive string that specifies the control key assigned to this 
        L"",                                    // help_topic
        L"Sig: >QX",   // function_help
        L"Argument ignored"                     // argument_help1
    },

// ...

__declspec(dllexport) void WINAPI Func5(LPXLOPER12 x, LPXLOPER12 asyncHandle)
{
    switch (x->xltype)
    {
    case xltypeNum:
    {
        // just break, not doing anything
        break;
    }
    default: break;
    }

    return;
}


This compiles fines and Excel loads it correctly, but as soon as I type "=func5()" the whole UI freezes, and waits for me to do anything; then shows "#Calc!".

I am fine with the error, but what's even the point of Async functions if the UI freezes? Am I doing something wrong?

5
  • You are calling it synchronously and expecting it to return a value. Commented Oct 29 at 16:55
  • Hm thanks? Can you expand a little? Commented Oct 29 at 18:54
  • =func5() puts the return value in the cell. What value are you returning? Commented Oct 29 at 19:35
  • In my understading, I am not supposed to return anything. that's why I declared it void and that's why I registered it with ">" as the first element of; also this is the example provided in the documentation Commented Oct 29 at 20:28
  • I am more and more inclined to think, the freeze is by design... And it's actually up to developer to implement its own worker pool & macro which writes results when ready, without using async functions Commented Oct 30 at 14:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.