addin.h

来自「一个以前收集的基于C/S架构的ERP客户端源代码」· C头文件 代码 · 共 136 行

H
136
字号
//
// F1AddIn.h
//
// Declarations for the C++ Add-In API for Formula One ActiveX version 6.1.
//
// Copyright (C) 1999 by Tidestone Technologies, Inc.  All rights reserved.
//

#ifndef __F1ADDIN_H__
#define __F1ADDIN_H__

// Error codes for Formula One formula evaluation.
//
// If Formula One encounters an S_OK error code in a VARIANT value, it will
// proceed as if the variant's type were VT_EMPTY.
//
// If Formula One encounters any other error code not listed here in a VARIANT
// value, it will proceed as if the error were F1_E_VALUE.
//
#define F1_E_NULL		0x80040001L // #NULL!
#define F1_E_DIVZERO	0x80040002L // #DIV/0!
#define F1_E_VALUE		0x80040003L // #VALUE!
#define F1_E_REF		0x80040004L // #REF!
#define F1_E_NAME		0x80040005L // #NAME?
#define F1_E_NUM		0x80040006L // #NUM!
#define F1_E_NA			0x80040007L // #N/A


// The following variant types may be passed to an add-in function as
// arguments from Formula One 6.1:
//
//		VT_EMPTY
//		VT_R8
//		VT_BSTR
//		VT_BOOL
//		VT_ERROR
//		VT_UNKNOWN  (see notes below)
//
// For compatibility with future versions of Formula One, an add-in function
// should fail "gracefully" if it encounters an unexpected variant type.  The
// recommended approach is for the add-in function to return an error of type
// E_F1_VALUE.  The add-in function may first attempt to convert the value to
// a useable type if desired.
//
// When the argument type is VT_UNKNOWN, the add-in function should call
// QueryInterface to obtain an interface implemented by Formula One's formula
// evaluator.  At this time, the only interfaces implemented are IF1AddInArray
// and IF1AddInArrayEx.  The interfaces are briefly explained here:
//
// IF1AddInArray    Query for this interface if you want to support only one-
//                  or two-dimensional arrays or area references.
//
// IF1AddInArrayEx  Query for this interface if you want to support unions or
//                  three-dimensional area references.  This interface also
//                  provides all the functionality of IF1AddInArray.
//
// These interfaces are implemented by Formula One 6.1 to pass area references
// (also known as range references) to the add-in function.  Note that Formula
// One 6.1 does not support arrays at this time.  While there are currently no
// plans to support arrays in the Formula One ActiveX, you can be assured that
// if such support is added in the future, these same interfaces will allow
// you to handle array arguments.
//
// If the add-in function fails to obtain a suitable interface through
// QueryInterface, it should return the error code F1_E_VALUE.

// The following variant types may be returned to Formula One 6.1 by an add-in
// function:
//
//		VT_EMPTY
//		VT_R8
//		VT_BSTR
//		VT_BOOL
//		VT_ERROR
//
// Any other type will be evaulated by Formula One as a #VALUE! error.



// These interfaces are implemented by Formula One to pass range reference
// arguments to add-in functions.
//
// GetValue
//
//   If nSheet, nRow, or nCol is outside the bounds of the array, pResult's
//   type is VT_ERROR and both the return value and pResult's value are
//   F1_E_REF.  Otherwise, the return value is S_OK and pResult's value is
//   the value of the element referred to by nSheet, nRow, and nCol.
//
//   It is possible for pResult's type to be VT_ERROR even if the return
//   value is S_OK.  If this happens, it means that the value of the element
//   is an error code such as #REF!, #NAME?, etc.  Generally speaking, the
//   proper response to such a situation is to immediately return the same
//   error code as the add-in function's own return value; but the add-in
//   function is free to handle such errors in another manner.

#define F1ADDIN_ARRAY 0 // Not implemented in Formula One 6.1
#define F1ADDIN_AREA 1
#define F1ADDIN_AREA3D 2
#define F1ADDIN_REGION 3
// Implemented by the add-in DLL once for each worksheet function defined by
// the add-in:
typedef HRESULT (CALLBACK *F1ADDIN_FUNCTION)(
		LPVARIANTARG pResult, // VARIANT that holds the result
		int nReserved, // ignore this
		int nArgs, // number of arguments
		LPVARIANTARG pArgs); // array of arguments

// Implemented by Formula One, and called by add-in's implementation of
// F1AddInInit, once for each function defined by the add-in:
typedef HRESULT (CALLBACK *F1AddInRegisterFunctionProc)(
		LPCWSTR pwszName, // Name of function
		int nReserved, // Must be zero
		F1ADDIN_FUNCTION pFunction, // Implementation of function
		int nArgs); // Number of arguments (-1 if the function accepts a variable number of arguments)

// Implemented by Formula One, and called by add-in's implementation of
// F1AddInInit one time to register the add-in's global information.
typedef HRESULT (CALLBACK *F1AddInRegisterInfoProc)(
		LPCWSTR pwszName, // Name of add-in
		LPCWSTR pwszDescription, // Description of add-in
		int nReserved1, // Must be zero
		int nReserved2); // Must be zero

// Implemented once by the add-in DLL:
extern "C" HRESULT __stdcall F1AddInInit(
		F1AddInRegisterInfoProc RegisterInfoProc, // See declaration of this type for info
		F1AddInRegisterFunctionProc RegisterFunctionProc, // See declaration of this type for info
		int nReserved1, // Ignore this
		int nReserved2); // Ignore this

#endif // __F1ADDIN_H__

// {8B803700-DAE4-11d2-A622-00A0C933C408}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?