home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Unleashed
/
Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso
/
repease
/
rep.h
< prev
next >
Wrap
C/C++ Source or Header
|
1995-07-18
|
17KB
|
366 lines
/*****************************************************************************
This file should be included into your application modules which call
the Report Right interface functions.
*****************************************************************************/
#if defined (_WIN32)
#if !defined(WIN32)
#define WIN32
#endif
#endif
/******************************************************************************
WIN32 specific defines
*******************************************************************************/
#if defined (WIN32)
#define huge
#define _export
#else
#define huge huge
#endif
/****************************************************************************
Instructions for packing the following structure
*****************************************************************************/
#ifndef RC_INVOKED
#pragma pack(1)
#endif
/*****************************************************************************
The parameter structure definition that is used by your application
to specify the operation parameters and text data to the 'form' routine.
For an example for using this structure, refer to the demo.c file.
*****************************************************************************/
typedef struct StrForm {
int x; // Initial x position of the editing window,
// you may specify CW_USEDEFAULT to use default values.
int y; // Initial y position of the editing window.
int width; // Initial width of the window in device units,
// you may specify CW_USEDEFAULT to use default values.
int height; // Initial height of the editing window. When you
// use CW_USEDEFAULT for width, the height parameter is
// ingnored.*/
int (FAR PASCAL _export *UserSelection)(HWND, struct StrField huge *,int);
/* a pointer to the function returning the user
selected field through the structure pointer.
Your application returns the chosen field through
the first parameter. The second argument indicates
the sort field number. If it is equal to zero,
it means that the field being sought is not a sort
field. The function returns a TRUE value if
successful.
When using ReportEase as a DLL, this pointer must
be passed using the MakeProcInstance function. Your
application must define this function as exportatable
and include it it the EXPORT section of the
definition file
*/
int (FAR PASCAL _export *VerifyField)(struct StrField huge *,int);
/* a pointer to the user routine that validate a
field name. The field name is passed to the routine
by the 'name' variable in the StrField structure.
This routine should also fill the 'type' variable
in the structure. The second arguement indicates the
sort field number. If it is equal to zero, it means
that the field to verify is not a sort field. The
function returns TRUE to indicate a valid field.
When using ReportEase as a DLL, this pointer must
be passed using the MakeProcInstance function. Your
application must define this function as exportatable
and include it it the EXPORT section of the
definition file
*/
char file[130]; // form file name. If an existing file is specified,
// the following fields are ignored.
char DataSetName[20];/* (Specify for a new file) Your application can
specify a data set name which can be used to
associate the application data to the form. This
is an optional field. */
BOOL ShowMenu; // show the menu bar ?
BOOL ShowHorBar;// show the horizonatal scroll bar
BOOL ShowVerBar;// show the vertical scroll bar
HANDLE hInst; // Handle of the current instanaces.
HANDLE hPrevInst; // Handle of the previous instances.
HWND hParentWnd;// Handle to the parent window
HWND hFrWnd; // Form main window handle, will be filled by RE later
DWORD style; // Editor window style
char FontTypeFace[32]; // Default type face, example: TmwRmn Courier, etc
BOOL open; // TRUE indicates an open window (parameter block in use)
BOOL modified; // TRUE when the file modified, and needs to be saved
};
typedef int (FAR PASCAL _export *USER_SELECTION)(HWND, struct StrField huge *,int);
typedef int (FAR PASCAL _export *VERIFY_FIELD)(struct StrField huge *,int);
/*****************************************************************************
The parameter structure definition that is used by your application
to specify the operation parameters to start a report execution session.
For an example for using this structure, refer to the demo.c file.
*****************************************************************************/
typedef struct StrRep {
char file[129]; // form file name
char device; // P=Printer,S=Screen,A=Ask the user. The following
// 4 parameters are not used if the device is
// set to 'P'
int x; // Initial x position of the report window,
// you may specify CW_USEDEFAULT to use default values.
int y; // Initial y position of the report window.
int width; // Initial width of the window in device units,
// you may specify CW_USEDEFAULT to use default values.
int height; // Initial height of the editing window. When you
// use CW_USEDEFAULT for width, the height parameter is
// ingnored.
struct StrField huge *field; // (OUTPUT) pointer to an array of fields used by the
// form
int TotalFields; // (OUTPUT) Number of fields in the 'field' array.
struct StrField huge *SortField; // (OUTPUT) pointer to an array of fields used for
// sorting.
int TotalSortFields; // (OUTPUT) Number of fields in the 'SortField' array.
char DataSetName[20];// (OUTPUT) This field returns the data set name
// associated with the form. Your application
// may use this information to prepare data for
// the report executer
char SwapDir[60]; // Directory path to store swapped screen pages
// When this variable is equal to NULL, RE will use
// the current working directory for swapping.
HANDLE hInst; // Handle of the current instanaces.
HANDLE hPrevInst; // Handle of the previous instances.
HWND hParentWnd; // Handle to the parent window
DWORD style; // Report window style - needed for screen output only
int (FAR PASCAL _export *DrawPicture)(HDC, int, int, int, RECT far *);
};
typedef int (FAR PASCAL _export *DRAW_PICTURE)(HDC, int , int, int, RECT far *);
/*****************************************************************************
Global Constants
*****************************************************************************/
#if defined (WIN32)
#define FORM_SIGN 0xDEBA
#else
#define FORM_SIGN 0xDEBC
#endif
#define UNITS_PER_INCH 250
#define NAME_WIDTH 50
#define SRC_APPL 0
#define SRC_CALC 1
#define SRC_SYS 2
#define SRC_CONST 3
#define SRC_NONE 4
#define SRC_DLG 5
#define TYPE_NUM 1
#define TYPE_DBL 2
#define TYPE_TEXT 3
#define TYPE_LOGICAL 4
#define TYPE_DATE 5
#define TYPE_PICT 6
#define SUM_NONE 0
#define SUM_TOTAL 1
#define SUM_AVERAGE 2
#define SUM_COUNT 3
#define SUM_MAX 4
#define SUM_MIN 5
#define DT_MMDDYY 0
#define DT_DDMMYY 1
#define DT_MMDDYYYY 2
#define DT_MMMDDYYYY 3
#define FLAG_TRIM 0x1
#define FLAG_SUP_ZERO 0x2
#define FLAG_PAD_ZERO 0x4
#define FLAG_CAPS 0x8
#define FLAG_FIRST_CAP 0x10
#define FLAG_SMALL 0x20
#define FLAG_COMMA 0x40
#define FLAG_WRAP 0x80
#define FLAG_WORD_WRAP 0x100
#define FLAG_RETAIN 0x200
#define FLAG_FLEX_SIZE 0x400
#define RFLAG_TRIAL 0x1
#define ERR_NO_FILE 1
#define ERR_NO_DEVICE 2
#define ERR_NO_MEM 3
#define ERR_BAD_EXP 4
#define ERR_SUSPEND 5
#define ERR_ZERO_DIVIDE 6
#define ERR_TYPE_MISMATCH 7
#define ERR_INCOMPLETE 8
#define ERR_DUPLICATE 9
#define ERR_PRINTER 10
#define ERR_IO 11
#define ERR_DISPLAY 12
#define ERR_WRAP 13
#define ERR_FONT 14
#define ERR_OTHER 15
#define ERR_BAD_WND 16
typedef long (FAR PASCAL _export *MSG_CALLBACK)(HWND,UINT);
/******************************************************************************
Form Header Structure
******************************************************************************/
struct StrFormHdr {
unsigned FormSign; // Form File Signature
char name[NAME_WIDTH+2]; // report name
char DataSetName[20]; // Your application can specify a data set
// name which can be used to associate the
// application data to the form. This
// is an optional information.
int TotalItems; // screen items in the form template
int FieldCount; // total number of fields
int BreakFieldCount; // total number of break fields
int FontCount; // number of entries in the font table
float LeftMargin; // margins in inches
float RightMargin;
float TopMargin;
float BottomMargin;
int SelExp[NAME_WIDTH+2]; // record selection expression
int Orientation; // DMORIENT_PORTRAIT or DMORIENT_LANDSCAPE
int PaperSize; // paper size given by DMPAPER_* variables used for DEVMODE
int PaperLength; // specified in tenths of millimeter, used only if PaperSize = 0
int PaperWidth; // specified in tenths of millimeter, used only if PaperSize = 0
int PrintQuality; // print quality
char PrinterName[NAME_WIDTH+2], // name of the printer
PrinterDriver[NAME_WIDTH+2]; // printer driver name
unsigned flags; // RFLAG_ series flags
int DateFormat; // 0=MM/DD/YY, 1=DD/MM/YY
int RulerType; // RULER_OFF,RULER_INCH,RULER_CM
int SecBannerHeight; // height (logical units) of the section banner
int FileFormatId; // records the file format changes
char reserved[146];
};
/******************************************************************************
Field Structure
******************************************************************************/
struct StrField { // define each field
int source; // source of field data: application,calculation,system, constant etc
char name[NAME_WIDTH+2]; // field name
int FileId; // an optional id that may be defined by the calling application
int FieldId; // another optional id that may be defined by the calling application
int type; // numeric/alphanumeric/logical/date
int width; // field data width as stored in your database
int DecPlaces; // decimal places for numeric fields
int AllowChanges; // Allow modification of the following fields
int InUse; // TRUE=in use, FALSE=not in use
unsigned flags; // flags
int SumType; // summary type: total/average/minmum/maximum/none
int SysIdx; // index into the system field table for system fields
int DateFormat; // date format
char DateDelim[2]; // date delimiter character, i.e. / or -
char CurrencySymbol[4]; // currency symbol
char LogicalSymbols[2]; // logical TRUE and FALSE symbols
char NegSignPrefix[4]; // negative sign prefix
char NegSignSuffix[4]; // negative sign suffix
char PosSignPrefix[4]; // positive sign prefix
char PosSignSuffix[4]; // positive sign suffix
int CalcExp[NAME_WIDTH+2]; // expression for the calculated fields
LPSTR CharData; // character data, pointer to an object of size = field.width+1
long NumData; // numeric data (long)
double DblData; // numeric data for field = TYPE_DBL
long HoldNum; // long accumulater: total,minimum,maximum,etc...
double HoldDbl; // double accumulater: total,minimum,maximum,etc...
long count; // number of records in a group during execution
int section; // section that holds the field (report time only)
int misc; // used for miscellaneous purposes
char ParaChar[2]; // specify the new paragraph indicator character
// in the first byte. Needed only for a word/wrapped
// text field.
char reserved[14]; // reserved to pad to 256
};
/****************************************************************************
Instructions to resume the default structure packing.
*****************************************************************************/
#ifndef RC_INVOKED
#pragma pack()
#endif
/******************************************************************************
Calleable Function Prototypes
When calling REP from a C program, leave the REP_CPLUSPLUS symbol undefined.
When calling REP from a C++ program, define the REP_CPLUSPLUS as following:
#define REP_CPLUSPLUS extern "C"
#include "rep.h"
******************************************************************************/
#ifndef REP_CPLUSPLUS
#define REP_CPLUSPLUS
#endif
REP_CPLUSPLUS int WINAPI _export form(struct StrForm far *);
REP_CPLUSPLUS int WINAPI _export RepInit(struct StrRep far *);
REP_CPLUSPLUS int WINAPI _export RepRec(void);
REP_CPLUSPLUS int WINAPI _export RepExit(void);
REP_CPLUSPLUS HWND WINAPI _export RepGetParent(void);
REP_CPLUSPLUS int WINAPI _export RepSetMsgCallback(MSG_CALLBACK);
/******************************************************************************
REP Messages
*******************************************************************************/
/*******************************************************************************
REP_CLOSE:
This message is sent to your application by the form editor and
report executer.
Form Editor sends this messages before closing the form editor window.
The report executer sends this message before after writing the last
report line.
*******************************************************************************/
#define REP_CLOSE (WM_USER)