Tham khảo tài liệu 'excel add-in development in c/c++ applications in finance phần 4', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Turning DLLs into XLLs The Add-in Manager Interface 101 Free memory allocated by new_xlstring free return 1 Using the C xloper class cpp_xloper introduced in section the above code can be rewritten as follows int __stdcall xlAutoRemove void cpp_xloper xStr Version has been removed cpp_xloper xInt 2 Dialog box type. Excel4 xlcAlert NULL 2 xStr xInt return 1 xlAddlnManagerlnfo xloper _stdcall xlAddInManagerInfo xloper Excel calls this function the first time the Add-in Manager is invoked. It should return an xloper string with the full name of the add-in which is then displayed in the Add-in Manager dialog Tools Add-lns. . See example below. If this function is omitted the Add-in Manager dialog simply displays the DOS filename of the add-in without the path or extension. The function should return 1 to indicate success. Here is a simple example which uses a DLL function new_xlstring to create a byte-counted string that is marked for freeing once Excel has copied the value out. xloper __stdcall xlAddInManagerInfo xloper p_arg if xll_initialised xlAutoOpen static xloper ret_oper xltypeErr xlerrValue if p_arg NULL return ret_oper if p_arg- xltype xltypeNum p_arg- p_arg- xltype xltypeInt p_arg- 1 Return a dynamically allocated byte-counted string and tell Excel to call back into the DLL to free it once Excel has finished. xltypeStr xlbitDLLFree new_xlstring My Add-in return ret_oper 102 Excel Add-in Development in C C Using the C xloper class cpp_xloper introduced in section the above code can be rewritten as follows xloper __stdcall xlAddInManagerInfo xloper p_arg . . . if xll_initialised xlAutoOpen cpp_xloper Arg p_arg cpp_xloper RetVal if Arg 1 RetVal AddinName else RetVal WORD xlerrValue return Invoking the Add-in Manager calls this function resulting in the following being displayed xlAutoRegister xloper __stdcall .