/*
** Microsoft Excel Developer's Toolkit
** Version 15.0
**
** File: INCLUDE\XLCALL.H
** Description: Header file for for Excel callbacks
** Platform: Microsoft Windows
**
** DEPENDENCY:
** Include <windows.h> before you include this.
**
** This file defines the constants and
** data types which are used in the
** Microsoft Excel C API.
**
*/
#pragma once
/*
** XL 12 Basic Datatypes
**/
typedef INT32 BOOL; /* Boolean */
typedef WCHAR XCHAR; /* Wide Character */
typedef INT32 RW; /* XL 12 Row */
typedef INT32 COL; /* XL 12 Column */
typedef DWORD_PTR IDSHEET; /* XL12 Sheet ID */
/*
** XLREF structure
**
** Describes a single rectangular reference.
*/
typedef struct xlref
{
WORD rwFirst;
WORD rwLast;
BYTE colFirst;
BYTE colLast;
} XLREF, *LPXLREF;
/*
** XLMREF structure
**
** Describes multiple rectangular references.
** This is a variable size structure, default
** size is 1 reference.
*/
typedef struct xlmref
{
WORD count;
XLREF reftbl[1]; /* actually reftbl[count] */
} XLMREF, *LPXLMREF;
/*
** XLREF12 structure
**
** Describes a single XL 12 rectangular reference.
*/
typedef struct xlref12
{
RW rwFirst;
RW rwLast;
COL colFirst;
COL colLast;
} XLREF12, *LPXLREF12;
/*
** XLMREF12 structure
**
** Describes multiple rectangular XL 12 references.
** This is a variable size structure, default
** size is 1 reference.
*/
typedef struct xlmref12
{
WORD count;
XLREF12 reftbl[1]; /* actually reftbl[count] */
} XLMREF12, *LPXLMREF12;
/*
** FP structure
**
** Describes FP structure.
*/
typedef struct _FP
{
unsigned short int rows;
unsigned short int columns;
double array[1]; /* Actually, array[rows][columns] */
} FP;
/*
** FP12 structure
**
** Describes FP structure capable of handling the big grid.
*/
typedef struct _FP12
{
INT32 rows;
INT32 columns;
double array[1]; /* Actually, array[rows][columns] */
} FP12;
/*
** XLOPER structure
**
** Excel's fundamental data type: can hold data
** of any type. Use "R" as the argument type in the
** REGISTER function.
**/
typedef struct xloper
{
union
{
double num; /* xltypeNum */
LPSTR str; /* xltypeStr */
#ifdef __cplusplus
WORD xbool; /* xltypeBool */
#else
WORD bool; /* xltypeBool */
#endif
WORD err; /* xltypeErr */
short int w; /* xltypeInt */
struct
{
WORD count; /* always = 1 */
XLREF ref;
} sref; /* xltypeSRef */
struct
{
XLMREF *lpmref;
IDSHEET idSheet;
} mref; /* xltypeRef */
struct
{
struct xloper *lparray;
WORD rows;
WORD columns;
} array; /* xltypeMulti */
struct
{
union
{
short int level; /* xlflowRestart */
short int tbctrl; /* xlflowPause */
IDSHEET idSheet; /* xlflowGoto */
} valflow;
WORD rw; /* xlflowGoto */
BYTE col; /* xlflowGoto */
BYTE xlflow;
} flow; /* xltypeFlow */
struct
{
union
{
BYTE *lpbData; /* data passed to XL */
HANDLE hdata; /* data returned from XL */
} h;
long cbData;
} bigdata; /* xltypeBigData */
} val;
WORD xltype;
} XLOPER, *LPXLOPER;
/*
** XLOPER12 structure
**
** Excel 12's fundamental data type: can hold data
** of any type. Use "U" as the argument type in the
** REGISTER function.
**/
typedef struct xloper12
{
union
{
double num; /* xltypeNum */
XCHAR *str; /* xltypeStr */
BOOL xbool; /* xltypeBool */
int err; /* xltypeErr */
int w;
struct
{
WORD count; /* always = 1 */
XLREF12 ref;
} sref; /* xltypeSRef */
struct
{
XLMREF12 *lpmref;
IDSHEET idSheet;
} mref; /* xltypeRef */
struct
{
struct xloper12 *lparray;
RW rows;
COL columns;
} array; /* xltypeMulti */
struct
{
union
{
int level; /* xlflowRestart */
int tbctrl; /* xlflowPause */
IDSHEET idSheet; /* xlflowGoto */
} valflow;
RW rw; /* xlflowGoto */
COL col; /* xlflowGoto */
BYTE xlflow;
} flow; /* xltypeFlow */
struct
{
union
{
BYTE *lpbData; /* data passed to XL */
HANDLE hdata; /* data returned from XL */
} h;
long cbData;
} bigdata; /* xltypeBigData */
} val;
DWORD xltype;
} XLOPER12, *LPXLOPER12;
/*
** XLOPER and XLOPER12 data types
**
** Used for xltype field of XLOPER and XLOPER12 structures
*/
#define xltypeNum 0x0001
#define xltypeStr 0x0002
#define xltypeBool 0x0004
#define xltypeRef 0x0008
#define xltypeErr 0x0010
#define xltypeFlow 0x0020
#define xltypeMulti 0x0040
#define xltypeMissing 0x0080
#define xltypeNil 0x0100
#define xltypeSRef 0x0400
#define xltypeInt 0x0800
#define xlbitXLFree 0x1000
#define xlbitDLLFree 0x4000
#define xltypeBigData (xltypeStr | xltypeInt)
/*
** Error codes
**
** Used for val.err field of XLOPER and XLOPER12 structures
** when constructing error XLOPERs and XLOPER12s
*/
#define xlerrNull 0
#define xlerrDiv0 7
#define xlerrValue 15
#define xlerrRef 23
#define xlerrName 29
#define xlerrNum 36
#define xlerrNA 42
#define xlerrGettingData 43
/*
** Flow data types
**
** Used for val.flow.xlflow field of XLOPER and XLOPER12 structures
** when constructing flow-control XLOPERs and XLOPER12s
**/
#define xlflowHalt 1
#define xlflowGoto 2
#define xlflowRestart 8
#define xlflowPause 16
#define xlflowResume 64
/*
** Return codes
**
** These values can be returned from Excel4(), Excel4v(), Excel12() or Excel12v().
*/
#define xlretSuccess 0 /* success */
#define xlretAbort 1 /* macro halted */
#define xlretInvXlfn 2 /* invalid function number */
#define xlretInvCount 4 /* invalid number of arguments */
#define xlretInvXloper 8 /* invalid OPER structure */
#define xlretStackOvfl 16 /* stack overflow */
#define xlretFailed 32 /* command failed */
#define xlretUncalced 64 /* uncalced cell */
#define xlretNotThreadSafe 128 /* not allowed during multi-threaded calc */
#define xlretInvAsynchronousContext 256 /* invalid asynchronous function handle */
#define xlretNotClusterSafe 512 /* not supported on cluster */
/*
** XLL events
**
** Passed in to an xlEventRegister call to register a corresponding event.
*/
#define xleventCalculationEnded 1 /* Fires at the end of calculation */
#define xleventCalculationCanceled 2 /* Fires when calculation is interrupted */
/*
** Function prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
int _cdecl Excel4(int xlfn, LPXLOPER operRes, int count,... );
/* followed by count LPXLOPERs */
int pascal Excel4v(int xlfn, LPXLOPER operRes, int count, LPXLOPER opers[]);
int _cdecl Excel12(int xlfn, LPXLOPER12 operRes, int count,... );
/* followed by count LPXLOPER12s */
int pascal Excel12v(int xlfn, LPXLOPER12 operRes, int count, LPXLOPER12 opers[]);
#ifdef __cplusplus
}
#endif