home *** CD-ROM | disk | FTP | other *** search
- '
- ' Visual Basic Declarations of CRPE.DLL
- ' =====================================
- '
- ' File: GLOBAL.BAS
- '
- ' Author: Crystal Computer Services, Inc.
- ' Date: 15 Apr 92
- '
- ' Purpose: This file presents the API to the Crystal Reports
- ' Print Engine DLL.
- '
- ' Language: Visual Basic for Windows
- '
- ' Copyright (c) 1992-1994 Crystal Services
- '
- ' Revisions:
- '
- ' CCS 15 Apr 92 - Original Development
- ' KYL 12 Jul 92 - Modified Existing Declarations
- ' Added Missing Declarations
- ' KYL 27 Aug 92 - Converted to CRPE.DLL
- ' CRD 08 Feb 93 - Added new calls for 2.0 and Global declares for samples
- ' CRD 25 Feb 93 - Added new calls for 2.0 Pro
- ' RBC 23 Apr 93 - Added more new calls, rearranged to match CRPE.H
- ' DVA 22 Dec 93 - Added new calls for 3.0
- ' TW 15 Mar 94 - 3.0 call reorganization
- '
- '----------------------------------------------------------------
- 'This Application's Global Variables
- Global Jobnumber As Integer
- Global ReportName As String
- Global EngineOpened As Integer
- Global GetErrortext As String
- Global FileType As Integer
- Global FileName As String
-
-
- ' Open, print and close report (used when no changes needed to report)
- ' --------------------------------------------------------------------
-
- Declare Function PEPrintReport Lib "CRPE.DLL" (ByVal RptName$, ByVal Printer%, ByVal Window%, ByVal Title$, ByVal Lft%, ByVal Top%, ByVal Wdth%, ByVal Height%, ByVal Style As Long, ByVal PWindow%) As Integer
-
-
- ' Open and close print engine
- ' ---------------------------
-
- Declare Function peopenengine Lib "CRPE.DLL" () As Integer
-
- Declare Sub PeCloseEngine Lib "CRPE.DLL" ()
-
-
- ' Get version info
- ' ----------------
-
- Const PE_GV_DLL = 100 ' values for version parameter of PEGetVersion
- Const PE_GV_ENGINE = 200
-
- Declare Function PEGetVersion Lib "CRPE.DLL" (ByVal version%) As Integer
-
-
- ' Open and close print job (i.e. report)
- ' --------------------------------------
-
- Declare Function PEOpenPrintJob Lib "CRPE.DLL" (ByVal RptName$) As Integer
-
- Declare Sub PEClosePrintJob Lib "CRPE.DLL" (ByVal PrintJob%)
-
-
- ' Start and cancel print job (i.e. print the report, usually after changing report)
- ' ---------------------------------------------------------------------------------
-
- Declare Function PEStartPrintJob Lib "CRPE.DLL" (ByVal PrintJob%, ByVal WaitOrNot%) As Integer
-
- Declare Sub PECancelPrintJob Lib "CRPE.DLL" (ByVal PrintJob%)
-
-
- ' Print job status
- ' ----------------
-
- Declare Function PEIsPrintJobFinished Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
-
- Type PEJobInfo
- StructSize As Integer ' initialize to # of bytes in PEJobInfo
-
- NumRecordsRead As Long
- NumRecordsSelected As Long
- NumRecordsPrinted As Long
-
- DisplayPageN As Integer
- LatestPageN As Integer
- StartPageN As Integer
-
- PrintEnded As Integer
- End Type
-
- Declare Function PEGetJobStatus Lib "CRPE.DLL" (ByVal PrintJob%, JobInfo As PEJobInfo) As Integer
-
-
- ' Print job error codes and messages
- ' ----------------------------------
-
- Declare Function PeGetErrorCode Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
-
- Declare Function PEGetErrorText Lib "CRPE.DLL" (ByVal PrintJob%, TextHandle%, TextLength%) As Integer
-
- Declare Function PEGetHandleString Lib "CRPE.DLL" (ByVal TextHandle%, ByVal Buffer$, ByVal BufferLength%) As Integer
-
-
- ' Setting the print date
- ' ----------------------
-
- Declare Function PESetPrintDate Lib "CRPE.DLL" (ByVal PrintJob%, ByVal Date_Year%, ByVal Date_Month%, ByVal Date_Day%) As Integer
-
-
- ' Controlling formulas, selection formulas and group selection formulas
- ' ---------------------------------------------------------------------
-
- Declare Function PEGetFormula Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FormulaName$, TextHandle%, TextLength%) As Integer
-
- Declare Function PESetFormula Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FormulaName$, ByVal FormulaString$) As Integer
-
- Declare Function PeGetSelectionFormula Lib "CRPE.DLL" (ByVal PrintJob%, TextHandle%, TextLength%) As Integer
-
- Declare Function PESetSelectionFormula Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FormulaString$) As Integer
-
- Declare Function PEGetGroupSelectionFormula Lib "CRPE.DLL" (ByVal PrintJob%, TextHandle%, TextLength%) As Integer
-
- Declare Function PESetGroupSelectionFormula Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FormulaString$) As Integer
-
-
- ' Controlling group conditions (i.e. group breaks)
- ' ------------------------------------------------
-
- Const PE_GC_ANYCHANGE = 0 ' values for the Condition parameter of PESetGroupCondition
- ' use PE_ANYCHANGE for all field types except Date and Boolean
-
- Const PE_GC_DAILY = 0 ' use these constants for Date fields
- Const PE_GC_WEEKLY = 1
- Const PE_GC_BIWEEKLY = 2
- Const PE_GC_SEMIMONTHLY = 3
- Const PE_GC_MONTHLY = 4
- Const PE_GC_QUARTERLY = 5
- Const PE_GC_SEMIANNUALLY = 6
- Const PE_GC_ANNUALLY = 7
-
- Const PE_GC_TOYES = 1 ' use these constants for Boolean fields
- Const PE_GC_TONO = 2
- Const PE_GC_EVERYYES = 3
- Const PE_GC_EVERYNO = 4
- Const PE_GC_NEXTISYES = 5
- Const PE_GC_NEXTISNO = 6
-
- Declare Function PESetGroupCondition Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SectionCode%, ByVal ConditionField$, ByVal Condition%, ByVal SortDirection%) As Integer
-
-
- ' Controlling sort order and group sort order
- ' -------------------------------------------
-
- Const PE_SF_MAXNAMELEN = 50 ' maximum length of a sort field name
-
- Const PE_SF_DESC = 0 ' values for the Direction parameter
- Const PE_SF_ASC = 1
-
- Declare Function PEGetNSortFields Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
-
- Declare Function PEGetNthSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortNumber%, NameHandle%, NameLength%, Direction%) As Integer
-
- Declare Function PESetNthSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortNumber%, ByVal SortFieldName$, ByVal Direction%) As Integer
-
- Declare Function PEDeleteNthSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortFieldN%) As Integer
-
- Declare Function PEGetNGroupSortFields Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
-
- Declare Function PEGetNthGroupSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortFieldN%, NameHandle%, NameLength%, Direction%) As Integer
-
- Declare Function PESetNthGroupSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortFieldN%, ByVal SortGroupName$, ByVal Direction%) As Integer
-
- Declare Function PEDeleteNthGroupSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortFieldN%) As Integer
-
-
- ' Controlling databases (see CRPE.H for more comments)
- ' ----------------------------------------------------
-
- Declare Function PEGetNTables Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
-
- Const PE_DLL_NAME_LEN = 64
- Const PE_FULL_NAME_LEN = 256
-
- Type PETableType
- StructSize As Integer ' initialize to # bytes in PETableType
-
- DLLName As String * PE_DLL_NAME_LEN
- DescriptiveName As String * PE_FULL_NAME_LEN
-
- DBType As Integer
- End Type
-
- Global Const PE_DT_STANDARD = 1 ' values for DBType
- Global Const PE_DT_SQL = 2
-
- Declare Function PEGetNthTableType Lib "CRPE.DLL" (ByVal PrintJob%, ByVal TableN%, TableType As PETableType) As Integer
-
- Const PE_LONGPTR_LEN = 4
- Const PE_SESS_USERID_LEN = 128
- Const PE_SESS_PASSWORD_LEN = 128
-
- Type PESessionInfo
- StructSize As Integer 'initialize to # bytes in PESessionInfo
-
- UserID As String * PE_SESS_PASSWORD_LEN
- Password As String * PE_SESS_PASSWORD_LEN
-
- SessionHandle As Long
- End Type
-
- Declare Function PEGetNthTableSessionInfo Lib "CRPE.DLL" (ByVal PrintJob%, ByVal TableN%, SessionInfo As PESessionInfo) As Integer
-
- Declare Function PESetNthTableSessionInfo Lib "CRPE.DLL" (ByVal PrintJob%, ByVal TableN%, SessionInfo As PESessionInfo, ByVal PropagateAcrossTables%) As Integer
-
- Const PE_SERVERNAME_LEN = 128
- Const PE_DATABASENAME_LEN = 128
- Const PE_USERID_LEN = 128
- Const PE_PASSWORD_LEN = 128
-
- Type PELogOnInfo
- StructSize As Integer ' initialize to # bytes in PELogOnInfo
-
- ' For any of the following values an empty string ("") means to use
- ' the value already set in the report. To override a value in the
- ' report use a non-empty string (e.g. "Server A"). All strings are
- ' null-terminated.
-
- ' For Netware SQL, pass the dictionary path name in ServerName and
- ' data path name in DatabaseName.
-
- ServerName As String * PE_SERVERNAME_LEN
- DatabaseName As String * PE_DATABASENAME_LEN
- UserID As String * PE_USERID_LEN
-
- ' Password is undefined when getting information from report.
-
- Password As String * PE_PASSWORD_LEN
- End Type
-
- Declare Function PEGetNthTableLogOnInfo Lib "CRPE.Dll" (ByVal PrintJob%, ByVal TableN%, LogOnInfo As PELogOnInfo) As Integer
- Declare Function PESetNthTableLogOnInfo Lib "CRPE.Dll" (ByVal PrintJob%, ByVal TableN%, LogOnInfo As PELogOnInfo, ByVal Propagate%) As Integer
-
- Const PE_TABLE_LOCATION_LEN = 256
-
- Type PETableLocation
- StructSize As Integer ' initialize to # bytes in PETableLocation
-
- ' String is null-terminated.
- Location As String * PE_TABLE_LOCATION_LEN
- End Type
-
- Declare Function PEGetNthTableLocation Lib "CRPE.Dll" (ByVal PrintJob%, ByVal TableN%, Location As PETableLocation) As Integer
- Declare Function PESetNthTableLocation Lib "CRPE.Dll" (ByVal PrintJob%, ByVal TableN%, Location As PETableLocation) As Integer
-
- Declare Function PETestNthTableConnectivity Lib "CRPE.Dll" (ByVal PrintJob%, ByVal TableN%) As Integer
-
- Declare Function PELogOnServer Lib "CRPE.Dll" (ByVal DLLName$, LogOnInfo As PELogOnInfo) As Integer
- Declare Function PELogOffServer Lib "CRPE.Dll" (ByVal DLLName$, LogOnInfo As PELogOnInfo) As Integer
-
- Declare Function PEGetNFiles Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
- Declare Function PEGetNthFileName Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FileN%, NameHandle%, NameLength%) As Integer
- Declare Function PESetNthFileName Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FileN%, ByVal Set_Name$) As Integer
-
-
- ' Overriding SQL query in report
- ' ------------------------------
-
- Declare Function PEGetSQLQuery Lib "CRPE.DLL" (ByVal PrintJob%, TextHandle%, TextLength%) As Integer
-
- Declare Function PESetSQLQuery Lib "CRPE.DLL" (ByVal PrintJob%, ByVal QueryString$) As Integer
-
-
- ' Refreshing saved data
- ' ---------------------
-
- Declare Function PESetRefreshData Lib "CRPE.DLL" (ByVal PrintJob%, ByVal RefreshData%) As Integer
-
-
- ' Report title
- ' ------------
-
- Declare Function PEGetReportTitle Lib "CRPE.DLL" (ByVal PrintJob%, TitleHandle%, TitleLength%) As Integer
- Declare Function PESetReportTitle Lib "CRPE.DLL" (ByVal PrintJob%, ByVal Title$) As Integer
-
-
- ' Controlling printed pages
- ' -------------------------
-
- Declare Function PEShowNextPage Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
-
- Declare Function PEShowFirstPage Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
-
- Declare Function PEShowPreviousPage Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
-
- Declare Function PEShowLastPage Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
-
- Declare Function PEShowPrintControls Lib "CRPE.DLL" (ByVal PrintJob%, ByVal ShowPrintControls%) As Integer
-
-
- ' Changing printer selection
- ' --------------------------
-
- Declare Function PESelectPrinter Lib "CRPE.DLL" (ByVal PrintJob%, ByVal PrinterDriver$, ByVal PrinterName$, ByVal PortName$, ByVal DevMode As Long) As Integer
-
-
- ' Controlling print to printer
- ' ----------------------------
-
- Declare Function PEOutputToDefaultPrinter Lib "CRPE.DLL" (ByVal PrintJob%, ByVal NCopies%) As Integer
-
- Declare Function PEOutPutToPrinter Lib "CRPE.DLL" (ByVal PrintJob%, ByVal NCopies%) As Integer
-
- Declare Function PESetNDetailCopies Lib "CRPE.DLL" (ByVal PrintJob%, ByVal nDetailCopies%) As Integer
-
- Const PE_MAXPAGEN = 65535
-
- Type PEPrintOptions
- StructSize As Integer ' initialize to # bytes in PEPrintOptions
-
- ' page and copy numbers are 1-origin
- ' use 0 to preserve the existing settings
- StartPageN As Integer
- stopPageN As Integer
-
- nReportCopies As Integer
- collation As Integer
- End Type
-
- ' values for collation
- Const PE_UNCOLLATED = 0
- Const PE_COLLATED = 1
- Const PE_DEFAULTCOLLATION = 2
-
- Declare Function PESetPrintOptions Lib "CRPE.Dll" (ByVal PrintJob%, Options As PEPrintOptions) As Integer
-
-
- ' Controlling print to window
- ' ---------------------------
-
- Declare Function PeOutPutToWindow Lib "CRPE.DLL" (ByVal PrintJob%, ByVal Title$, ByVal Lft%, ByVal Top%, ByVal Wdth%, ByVal Height%, ByVal Style As Long, ByVal PWindow%) As Integer
-
- Declare Function PEGetWindowHandle Lib "CRPE.DLL" (ByVal PrintJob%) As Integer
-
- Declare Function PEPrintWindow Lib "CRPE.Dll" (ByVal PrintJob%, ByVal WaitNoWait%) As Integer
-
- Declare Sub PECloseWindow Lib "CRPE.DLL" (ByVal PrintJob%)
-
-
- ' Controlling print to file and export
- ' ------------------------------------
-
- ' Types for the Options parameter of PEOutputToFile
- ' Use for all types except PE_FT_CHARSEPARATED
- Type PEPrintFileOptions
- StructSize As Integer ' initialize to # of bytes in PEPrintFileOptions
-
- UseReportNumberFmt As Integer
- UseReportDateFormat As Integer
- End Type
-
- Const PE_FIELDDELIMLEN = 17
-
- ' Use for PE_FT_CHARSEPARATED
- Type PECharSepFileOptions
- StructSize As Integer ' initialize to # of bytes in PECharSepFileOptions
-
- UseReportNumberFmt As Integer
- UseReportDateFormat As Integer
- StringDelimiter As String * 1
- FieldDelimiter As String * PE_FIELDDELIMLEN
- End Type
-
- ' values for FileType
- Const PE_FT_RECORD = 0
- Const PE_FT_TABSEPARATED = 1
- Const PE_FT_TEXT = 2
- Const PE_FT_DIF = 3
- Const PE_FT_CSV = 4
- Const PE_FT_CHARSEPARATED = 5
- Const PE_FT_TABFORMATTED = 6
-
- Declare Function PEOutPutToFile Lib "CRPE.DLL" (ByVal PrintJob%, ByVal OutputFilePath$, ByVal FileType%, Options As Any) As Integer
-
- Type PEExportOptions
- StructSize As Integer 'initialize to # bytes in PEExportOptions
-
- FormatDLLName As String * PE_DLL_NAME_LEN
- FormatType As Long
- FormatOptions As Long
- DestinationDLLName As String * PE_DLL_NAME_LEN
- DestinationType As Long
- DestinationOptions As Long
- NFormatOptionsBytes As Integer
- NDestinationOptionsBytes As Integer
- End Type
-
- Declare Function PEGetExportOptions Lib "CRPE.DLL" (ByVal PrintJob%, ExportOptions As PEExportOptions) As Integer
-
- Declare Function PEExportTo Lib "CRPE.DLL" (ByVal PrintJob%, ExportOptions As PEExportOptions) As Integer
-
-
- ' Setting page margins
- ' --------------------
-
- Declare Function PESetMargins Lib "CRPE.DLL" (ByVal PrintJob%, ByVal LeftMargin%, ByVal RightMargin%, ByVal TopMargin%, ByVal BottomMargin%) As Integer
-
-
- ' Setting section height and format
- ' ---------------------------------
-
- ' values for SectionCode parameter
- Const PE_ALLSECTIONS = 0
- Const PE_HEADERSECTION = 2000
- Const PE_GROUPHEADER = 3000 ' outer group header is 3000, next is 3001, etc.
- Const PE_DETAILSECTION = 4000
- Const PE_GROUPFOOTER = 5000 ' outer group footer is 5000, next is 5001, etc.
- Const PE_GRANDTOTALSECTION = 6000
- Const PE_FOOTERSECTION = 7000
-
- ' MinimumHeight is in twips - 1440 twips to the inch
- Declare Function PESetMinimumSectionHeight Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SectionCode%, ByVal MinimumHeight%) As Integer
-
- Type PESectionOptions
- StructSize As Integer ' initialize to # bytes in PESectionOptions
-
- ' use 0 to turn off, 1 to turn on and -1 to preserve each attribute
- Visible As Integer
- NewPageBefore As Integer
- NewPageAfter As Integer
- KeepTogether As Integer
- SuppressBlankLines As Integer
- ResetPageNAfter As Integer
- PrintAtBottomOfPage As Integer
- End Type
-
- Declare Function PESetSectionFormat Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SectionCode%, Options As PESectionOptions) As Integer
-
-
- ' Setting line height
- ' -------------------
-
- ' use PE_ALLLINES to set the height of all lines in a section
- Const PE_ALLLINES = -1
-
- ' Height and Ascent are in twips
- Declare Function PESetLineHeight Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SectionCode%, ByVal LineN%, ByVal Height%, ByVal Ascent%) As Integer
-
-
- ' Setting font info
- ' -----------------
-
- ' values for ScopeCode - may be ORed together
- Const PE_FIELDS = 1
- Const PE_TEXT = 2
-
- ' use for isItalic, isUnderlined, or isStruckOut to preserve the existing value
- Const PE_UNCHANGED = -1
-
- Declare Function PESetFont Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SectionCode%, ByVal ScopeCode%, ByVal FaceName$, ByVal FontFamily%, ByVal FontPitch%, ByVal CharSet%, ByVal PointSize%, ByVal isItalic%, ByVal isUnderlined%, ByVal isStruckOut%, ByVal Weight%)
-
-