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

Các thành viên của cpp_xloper chức năng Excel () gọi Excel4v () / Excel12v (), và thiết lập một lá cờ để cho các lớp học để sử dụng xlFree miễn phí bộ nhớ. (xloper/xloper12s điểm xltypeRef loại để cấp phát bộ nhớ). Mã IsActiveRef (), | 446 Excel Add-in Development in C C xloper __stdcall ExampleActiveOnly xloper pTrigger static count 0 could be incremented by more than one thread cpp_xloper Op xlfCaller Set Op caller s reference if Op count re-use Op for the return value else return the last value fails if not registered as type return The cpp_xloper s member function Excel calls Excel4v Excel12v and sets a flag to tell the class to use xlFree to free the memory. xloper xloper12s of type xltypeRef point to allocated memory . The code for IsActiveRef listed below uses the C API-only function xlSheetId to obtain the ID of the active sheet. Note that this ID is not the same as the .Index property from the above VBA example which is simply the index in the workbook s collection of sheets. Is the xloper a reference on the active sheet bool cpp_xloper IsActiveRef void const DWORD id if gExcelVersion12plus if xltypeSRef then convert to xltypeRef xloper12 as_ref 0 xltypeNil xloper12 type 0 xltypeInt xltypeRef Excel12 xlCoerce as_ref 2 m_Op12 type if xltypeRef return false id Excel12 xlFree 0 1 as_ref else if xltypeRef id else return false xloper12 active_sheet_id if Excel12 xlSheetId active_sheet_id 0 xltypeRef id No need to call xlFree active_sheet_id s xlmref pointer is NULL return false else if xltypeSRef then convert to xltypeRef Miscellaneous Topics 447 xloper as_ref 0 xltypeNil xloper type 0 xltypeInt xltypeRef Excel4 xlCoerce as_ref 2 m_Op type if xltypeRef return false id Excel4 xlFree 0 1 as_ref else if xltypeRef id else return false xloper active_sheet_id if Excel4 xlSheetId active_sheet_id 0 xltypeRef id No need to call xlFree .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
133    105    3    28-03-2024
192    52    1    28-03-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.