tailieunhanh - Financial Applications using Excel Add-in Development in C/C++ phần 6

và nên kiểm tra mỗi của các yếu tố đó không cần được trả tự do (mà họ không trong ví dụ này). Sau đó, nó miễn phí bộ nhớ mảng xloper. Các mã sau đây làm điều tương tự, nhưng sử dụng lớp cpp_xloper giới thiệu trong phần trên trang 146. Các mã được đơn giản hóa, nhưng những điều tương tự đang xảy ra - chỉ cần ẩn trong lớp. | Accessing Excel Functionality Using the C API 269 xloper __stdcall is_error_UDF xloper p_op code omitted And then a line in xlAutoOpen to register the functions Registration method 3 Register all instances of RegData supports dual-version interface RegData RegisterAll And a line in xlAutoClose to release the class instance array Explicitly clear the RegData instance pointer table RegData ClearData The example projects on the CD ROM also contain a similar class-based approach for exported commands. Getting and using the function s register ID In the above sections register_function and register_dual_function register a function and return an xloper cpp_xloper. If successful this is of type xltypeNum and contains a unique register ID. This ID is intended to be used in calls to xlfUnregister. However a bug in Excel prevents this from un-registering functions as intended - see next section. If you did not record the ID that xlfRegister returned you can get it at any time using the xlfRegisterId function. This takes 3 arguments 1. DllName The name of the DLL as returned by the function xlGetName. 2. FunctionName The name of the function as exported and passed in the 2nd argument to xlfRegister. 3. ArgRtnTypes The string that encodes the return and argument types the calling permission and volatile status of the function as passed in the 3rd argument to xlfRegister. The macro sheet functions that take this ID as an argument are xlfUnregister See next section. xlfCall Calls a DLL function. There is no point in calling this function where the caller is in the same DLL but it does provide a means for inter-DLL calling. The macro sheet version of this function CALL used to be available on worksheets. This enabled a spreadsheet with no XLM or VBA macros to access any DLL s functionality without alerting the user to the potential misuse that this could be put to. This security chasm was closed in version . 270 Excel Add-in Development in C C Un-registering a .

TỪ KHÓA LIÊN QUAN