home *** CD-ROM | disk | FTP | other *** search
/ BUG 4 / BUGCD1997_05.BIN / aplic / clip4win / clip4win.exe / C4W30E.HUF / SOURCE / CONTRIB / CRYSTAL.ZIP / CRYSTAL.PRG < prev   
Text File  |  1994-05-09  |  14KB  |  310 lines

  1. /*CRYSTAL REPORTS 3.0 API for Clip4Win
  2. ******* (NOT FULLY TESTED) *******
  3.   Use Crystal Reports documentation for 
  4.   function usage.
  5. */
  6.  
  7. #define WIN_WANT_PRO
  8. #include "crystal.ch"
  9. STATIC hLibCRPE
  10. *************************
  11. ***** Load CRPE DLL *****
  12. *************************
  13. Function CRPE(lOn)
  14.     local hInst := _GetInstance()
  15.     if lOn .and. hLibCRPE == nil
  16.         hLibCRPE := LoadLibrary("CRPE.DLL")
  17.         if hLibCRPE == nil .or. hLibCRPE < 32
  18.             MessageBox( , "Unable to find CRPE.DLL", "Error", MB_ICONSTOP)
  19.             hLibCRPE := nil
  20.         endif
  21.     elseif !lOn .and. hLibCRPE != nil
  22.         FreeLibrary(hLibCRPE)
  23.         hLibCRPE := nil
  24.     endif
  25. RETURN hLibCRPE
  26. ***************************
  27. ***** Print Only Link *****
  28. ***************************
  29. Function PEPrintReport(cReport,lToPrinter,lToWindow,cTitle,nLeft,nTop,nWidth,nHeight,nlStyle,hWndDlg)
  30.     local    cDLL := GetProcAddress(hLibCRPE, "PEPrintReport", "Pascal", "int",;
  31.                                             "str,log,log,str,int,int,int,int,long,HWND")
  32. RETURN (CallDLL(cDLL,cReport,lToPrinter,lToWindow,cTitle,nLeft,nTop,nWidth,nHeight,nlStyle,hWndDlg))
  33.  
  34. *********************************************
  35. ***** Print Engine Management Functions *****
  36. *********************************************
  37. Function PEOpenEngine()
  38.     local cDLL := GetProcAddress(hLibCRPE, "PEOpenEngine", "Pascal", "bool", "")
  39. RETURN (CallDLL(cDLL))
  40.  
  41. Function PECloseEngine()
  42.     local cDLL := GetProcAddress(hLibCRPE, "PECloseEngine", "Pascal", "void", "")
  43. RETURN (CallDLL(cDLL))
  44.  
  45. Function PEGetVersion(nRequest)
  46.     local cDLL := GetProcAddress(hLibCRPE, "PEGetVersion", "Pascal", "long", "long")
  47. RETURN (CallDLL(cDLL,nRequest))
  48.  
  49. *********************************************
  50. ***** Print Job Management Functions ********
  51. *********************************************
  52. Function PEOpenPrintJob(cRPT)
  53.     local cDLL := GetProcAddress(hLibCRPE, "PEOpenPrintJob", "Pascal", "int", "str")
  54. RETURN (CallDLL(cDLL,cRPT))
  55.  
  56. Function PEClosePrintJob(hPrintJob)
  57.     local cDLL := GetProcAddress(hLibCRPE, "PEClosePrintJob", "Pascal", "void", "int")
  58. RETURN (CallDLL(cDLL,hPrintJob))
  59.  
  60. Function PEStartPrintJob(hPrintJob,lWait)
  61.     local cDLL := GetProcAddress(hLibCRPE, "PEStartPrintJob", "Pascal", "bool", "int,bool")
  62. RETURN (CallDLL(cDLL,hPrintJob,lWait))
  63.  
  64. Function PEGetJobStatus(hPrintJob,cJobInfo)
  65.     local cDLL := GetProcAddress(hLibCRPE, "PEGetJobStatus", "Pascal", "int", "int,str")
  66. RETURN (CallDLL(cDLL,hPrintJob,cJobInfo))
  67.  
  68. ************************************************
  69. ***** Print Window Management Functions ********
  70. ************************************************
  71. Function PEGetWindowHandle(hPrintJob)
  72.     local cDLL := GetProcAddress(hLibCRPE, "PEGetWindowHandle", "Pascal", "int", "int")
  73. RETURN (CallDLL(cDLL,hPrintJob))
  74.  
  75. Function PEPrintWindow(hPrintJob,lWait)
  76.     local cDLL := GetProcAddress(hLibCRPE, "PEPrintWindow", "Pascal", "bool", "int,bool")
  77. RETURN (CallDLL(cDLL,hPrintJob,lWait))
  78.  
  79. Function PECloseWindow(hPrintJob)
  80.     local cDLL := GetProcAddress(hLibCRPE, "PECloseWindow", "Pascal", "void", "int")
  81. RETURN (CallDLL(cDLL,hPrintJob))
  82.  
  83. ******************************************
  84. ***** Print Destination Functions ********
  85. ******************************************
  86. Function PESelectPrinter(hPrintJob,cDriver,cPrinter,cPort,cDevMode)
  87.     local cDLL := GetProcAddress(hLibCRPE, "PESelectPrinter", "Pascal", "bool", "int,str,str,str,str")
  88. RETURN (CallDLL(cDLL,hPrintJob,cDriver,cPrinter,cPort,cDevMode))
  89.  
  90. Function PEOutputToPrinter(hPrintJob,nCopies)
  91.     local cDLL := GetProcAddress(hLibCRPE, "PEOutputToPrinter", "Pascal", "bool", "int,int")
  92. RETURN (CallDLL(cDLL,hPrintJob,nCopies))
  93.  
  94. Function PEOutputToWindow(hPrintJob,cTitle,nLeft,nTop,nWidth,nHeight,nStyle,hWndDlg)
  95.     local cDLL := GetProcAddress(hLibCRPE, "PEOutputToWindow", "Pascal", "int",;
  96.                                             "int,str,int,int,int,int,long,HWND")
  97. RETURN (CallDLL(cDLL,hPrintJob,cTitle,nLeft,nTop,nWidth,nHeight,nStyle,hWndDlg))
  98.  
  99. Function PEOutputToFile(hPrintJob,cFile,nType,cOptions)
  100.     local cDLL := GetProcAddress(hLibCRPE, "PEOutputToFile", "Pascal", "bool", "int,str,int,str")
  101. RETURN (CallDLL(cDLL,hPrintJob,cFile,nType,cOptions))
  102.  
  103. ********************************
  104. ***** Sorting Functions ********
  105. ********************************
  106. Function PEGetNSortFields(hPrintJob)
  107.     local cDLL := GetProcAddress(hLibCRPE, "PEGetNSortFields", "Pascal", "int", "int")
  108. RETURN (CallDLL(cDLL,hPrintJob))
  109.  
  110. Function PEGetNthSortField(hPrintJob,nField,cField,nFieldLen,nDirection)
  111.     local cDLL := GetProcAddress(hLibCRPE, "PEGetNthSortFields", "Pascal", "bool", "int,int,str,int,int")
  112. RETURN (CallDLL(cDLL,hPrintJob,nField,cField,nFieldLen,nDirection))
  113.  
  114. Function PESetNthSortField(hPrintJob,nField,cField,nDirection)
  115.     local cDLL := GetProcAddress(hLibCRPE, "PESetNthSortFields", "Pascal", "bool", "int,int,str,int")
  116. RETURN (CallDLL(cDLL,hPrintJob,nField,cField,nDirection))
  117.  
  118. Function PEDeleteNthSortField(hPrintJob,nField)
  119.     local cDLL := GetProcAddress(hLibCRPE, "PEDeleteNthSortFields", "Pascal", "bool", "int,int")
  120. RETURN (CallDLL(cDLL,hPrintJob,nField))
  121.  
  122. Function PEGetNGroupSortFields(hPrintJob)
  123.     local cDLL := GetProcAddress(hLibCRPE, "PEGetNGroupSortFields", "Pascal", "int", "int")
  124. RETURN (CallDLL(cDLL,hPrintJob))
  125.  
  126. Function PEGetNthGroupSortField(hPrintJob,nField,cField,nFieldLen,nDirection)
  127.     local cDLL := GetProcAddress(hLibCRPE, "PEGetNthGroupSortField", "Pascal", "bool", "int,int,str,int,int")
  128. RETURN (CallDLL(cDLL,hPrintJob,nField,cField,nFieldLen,nDirection))
  129.  
  130. Function PESetNthGroupSortField(hPrintJob,nField,cField,nDirection)
  131.     local cDLL := GetProcAddress(hLibCRPE, "PESetNthGroupSortField", "Pascal", "bool", "int,int,str,int")
  132. RETURN (CallDLL(cDLL,hPrintJob,nField,cField,nDirection))
  133.  
  134. Function PEDeleteNthGroupSortField(hPrintJob,nField)
  135.     local cDLL := GetProcAddress(hLibCRPE, "PEDeleteNthGroupSortField", "Pascal", "bool", "int,int")
  136. RETURN (CallDLL(cDLL,hPrintJob,nField))
  137.  
  138. ********************************
  139. ***** Formula Functions ********
  140. ********************************
  141. Function PEGetFormula(hPrintJob,cFormName,cFormula,nFormula)
  142.     local cDLL := GetProcAddress(hLibCRPE, "PEGetFormula", "Pascal", "bool", "int,str,int,int")
  143. RETURN (CallDLL(cDLL,hPrintJob,cFormName,cFormula,nFormula))
  144.  
  145. Function PESetFormula(hPrintJob,cFormName,cFormula)
  146.     local cDLL := GetProcAddress(hLibCRPE, "PESetFormula", "Pascal", "bool", "int,str,str")
  147. RETURN (CallDLL(cDLL,hPrintJob,cFormName,cFormula))
  148.  
  149. ******************************************
  150. ***** Selection Formula Functions ********
  151. ******************************************
  152. Function PEGetSelectionFormula(hPrintJob,cFormula,nFormula)
  153.     local cDLL := GetProcAddress(hLibCRPE, "PEGetSelectionFormula", "Pascal", "bool", "int,int,int")
  154. RETURN (CallDLL(cDLL,hPrintJob,cFormula,nFormula))
  155.  
  156. Function PESetSelectionFormula(hPrintJob,cFormula)
  157.     local cDLL := GetProcAddress(hLibCRPE, "PESetSelectionFormula", "Pascal", "bool", "int,str")
  158. RETURN (CallDLL(cDLL,hPrintJob,cFormula))
  159.  
  160. Function PEGetGroupSelectionFormula(hPrintJob,cFormula,nFormula)
  161.     local cDLL := GetProcAddress(hLibCRPE, "PEGetGroupSelectionFormula", "Pascal", "bool", "int,int,int")
  162. RETURN (CallDLL(cDLL,hPrintJob,cFormula,nFormula))
  163.  
  164. Function PESetGroupSelectionFormula(hPrintJob,cFormula)
  165.     local cDLL := GetProcAddress(hLibCRPE, "PESetGroupSelectionFormula", "Pascal", "bool", "int,str")
  166. RETURN (CallDLL(cDLL,hPrintJob,cFormula))
  167.  
  168. ******************************************
  169. ***** Error Management Functions *********
  170. ******************************************
  171. Function PEGetErrorCode(hPrintJob)
  172.     local cDLL := GetProcAddress(hLibCRPE, "PEGetErrorCode", "Pascal", "int", "int")
  173. RETURN (CallDLL(cDLL,hPrintJob))
  174.  
  175. Function PEGetErrorText(hPrintJob,hError,nError)
  176.     local cDLL := GetProcAddress(hLibCRPE, "PEGetErrorText", "Pascal", "bool", "int,int,int")
  177. RETURN (CallDLL(cDLL,hPrintJob,hError,nError))
  178.  
  179. ******************************************
  180. ****** Miscellaneous Functions ***********
  181. ******************************************
  182. Function PEGetHandleString(hText,cBuffer,nBuffer)
  183.     local cDLL := GetProcAddress(hLibCRPE, "PEGetHandleString", "Pascal", "bool", "int,str,int")
  184. RETURN (CallDLL(cDLL,hText,cBuffer,nBuffer))
  185.  
  186. ******************************************
  187. ****** Print Format Management ***********
  188. ******************************************
  189. Function PEGetReportTitle(hPrintJob,hTitle,nTitle)
  190.     local cDLL := GetProcAddress(hLibCRPE, "PEGetReportTitle", "Pascal", "bool", "int,int,int")
  191. RETURN (CallDLL(cDLL,hPrintJob,hTitle,nTitle))
  192.  
  193. Function PESetReportTitle(hPrintJob,cTitle)
  194.     local cDLL := GetProcAddress(hLibCRPE, "PESetReportTitle", "Pascal", "bool", "int,str")
  195. RETURN (CallDLL(cDLL,hPrintJob,cTitle))
  196.  
  197. Function PESetMargins(hPrintJob,nLeft,nRight,nTop,nBottom)
  198.     local cDLL := GetProcAddress(hLibCRPE, "PESetMargins", "Pascal", "bool", "int,int,int,int,int")
  199. RETURN (CallDLL(cDLL,hPrintJob,nLeft,nRight,nTop,nBottom))
  200.  
  201. Function PESetPrintOptions(hPrintJob,cOptions)
  202.     local cDLL := GetProcAddress(hLibCRPE, "PESetPrintOptions", "Pascal", "bool", "int,str")
  203. RETURN (CallDLL(cDLL,hPrintJob,cOptions))
  204.  
  205. Function PESetSectionFormat(hPrintJob,nCode,cOptions)
  206.     local cDLL := GetProcAddress(hLibCRPE, "PESetSectionFormat", "Pascal", "bool", "int,int,str")
  207. RETURN (CallDLL(cDLL,hPrintJob,nCode,cOptions))
  208.  
  209. Function PESetMinimumSectionHeight(hPrintJob,nCode,nHeight)
  210.     local cDLL := GetProcAddress(hLibCRPE, "PESetMinimumSectionHeight", "Pascal", "bool", "int,int,int")
  211. RETURN (CallDLL(cDLL,hPrintJob,nCode,nHeight))
  212.  
  213. Function PESetLineHeight(hPrintJob,nCode,nLine,nHeight,nAscent)
  214.     local cDLL := GetProcAddress(hLibCRPE, "PESetLineHeight", "Pascal", "bool", "int,int,int,int,int")
  215. RETURN (CallDLL(cDLL,hPrintJob,nCode,nLine,nHeight,nAscent))
  216.  
  217. Function PESetFont(hPrintJob,nCode,nScope,cFont,nFamily,nPitch,nSet,nPoint,lItalic,lUnderline,lStrike,nWeight)
  218.     local cDLL := GetProcAddress(hLibCRPE, "PESetFont", "Pascal", "bool",;
  219.                                             "int,int,int,str,int,int,int,int,bool,bool,bool,int")
  220. RETURN (CallDLL(cDLL,hPrintJob,nCode,nScope,cFont,nFamily,nPitch,nSet,nPoint,lItalic,lUnderline,lStrike,nWeight))
  221.  
  222. Function PESetNDetailCopies(hPrintJob,nCopies)
  223.     local cDLL := GetProcAddress(hLibCRPE, "PESetNDetailCopies", "Pascal", "bool", "int,int")
  224. RETURN (CallDLL(cDLL,hPrintJob,nCopies))
  225.  
  226. Function PESetPrintDate(hPrintJob,nYear,nMonth,nDay)   //***A Clipper date field is acceptable***
  227.     local cDLL := GetProcAddress(hLibCRPE, "PESetNDetailCopies", "Pascal", "bool", "int,int,int,int")
  228.     if valtype(nYear)=="D"
  229.         nYear:=val(left(dtos(nYear),4))
  230.         nMonth:=val(right(dtos(nYear),2))
  231.         nDay:=val(left(dtoc(nYear),2))
  232.     endif
  233. RETURN (CallDLL(cDLL,hPrintJob,nYear,nMonth,nDay))
  234.  
  235. Function PEExportTo(hPrintJob,cOption)
  236.     local cDLL := GetProcAddress(hLibCRPE, "PEExportTo", "Pascal", "bool", "int,str")
  237. RETURN (CallDLL(cDLL,hPrintJob,cOption))
  238.  
  239. **************************************
  240. ***** Print Window Customization *****
  241. **************************************
  242. Function PEShowNextPage(hPrintJob)
  243.     local cDLL := GetProcAddress(hLibCRPE, "PEShowNextPage", "Pascal", "bool", "int")
  244. RETURN (CallDLL(cDLL,hPrintJob))
  245.  
  246. Function PEShowFirstPage(hPrintJob)
  247.     local cDLL := GetProcAddress(hLibCRPE, "PEShowFirstPage", "Pascal", "bool", "int")
  248. RETURN (CallDLL(cDLL,hPrintJob))
  249.  
  250. Function PEShowPreviousPage(hPrintJob)
  251.     local cDLL := GetProcAddress(hLibCRPE, "PEShowPreviousPage", "Pascal", "bool", "int")
  252. RETURN (CallDLL(cDLL,hPrintJob))
  253.  
  254. Function PEShowLastPage(hPrintJob)
  255.     local cDLL := GetProcAddress(hLibCRPE, "PEShowLastPage", "Pascal", "bool", "int")
  256. RETURN (CallDLL(cDLL,hPrintJob))
  257.  
  258. Function PEShowPrintControls(hPrintJob,lControls)
  259.     local cDLL := GetProcAddress(hLibCRPE, "PEShowPrintControls", "Pascal", "bool", "int,bool")
  260. RETURN (CallDLL(cDLL,hPrintJob,lControls))
  261.  
  262. *****************************
  263. ***** Server Management *****
  264. *****************************
  265. Function PELogOnServer(cName,cLogonInfo)
  266.     local cDLL := GetProcAddress(hLibCRPE, "PELogOnServer", "Pascal", "bool", "str,str")
  267. RETURN (CallDLL(cDLL,cName,cLogonInfo))
  268.  
  269. Function PELogOffServer(cName,cLogonInfo)
  270.     local cDLL := GetProcAddress(hLibCRPE, "PELogOffServer", "Pascal", "bool", "str,str")
  271. RETURN (CallDLL(cDLL,cName,cLogonInfo))
  272.  
  273. ****************************
  274. ***** Table Management *****
  275. ****************************
  276. Function PEGetNTables(hPrintJob)
  277.     local cDLL := GetProcAddress(hLibCRPE, "PEGetNTables", "Pascal", "int", "int")
  278. RETURN (CallDLL(cDLL,hPrintJob))
  279.  
  280. Function PEGetNthTableType(hPrintJob,nTable,cTable)
  281.     local cDLL := GetProcAddress(hLibCRPE, "PEGetNthTableType", "Pascal", "bool", "int,int,str")
  282. RETURN (CallDLL(cDLL,hPrintJob,nTable,cTable))
  283.  
  284. Function PEGetNthTableLogOnInfo(hPrintJob,nTable,cLogon)
  285.     local cDLL := GetProcAddress(hLibCRPE, "PEGetNthTableLogOnInfo", "Pascal", "bool", "int,int,str")
  286. RETURN (CallDLL(cDLL,hPrintJob,nTable,cLogon))
  287.  
  288. Function PESetNthTableLogOnInfo(hPrintJob,nTable,cLogon,lProp)
  289.     local cDLL := GetProcAddress(hLibCRPE, "PESetNthTableLogOnInfo", "Pascal", "bool", "int,int,str,bool")
  290. RETURN (CallDLL(cDLL,hPrintJob,nTable,cLogon,lProp))
  291.  
  292. Function PEGetNthTableLocation(hPrintJob,nTable,cLocation)
  293.     local cDLL := GetProcAddress(hLibCRPE, "PEGetNthTableLocation", "Pascal", "bool", "int,int,str")
  294. RETURN (CallDLL(cDLL,hPrintJob,nTable,cLocation))
  295.  
  296. Function PESetNthTableLocation(hPrintJob,nTable,cLocation)
  297.     local cDLL := GetProcAddress(hLibCRPE, "PESetNthTableLocation", "Pascal", "bool", "int,int,str")
  298. RETURN (CallDLL(cDLL,hPrintJob,nTable,cLocation))
  299.  
  300. Function PETestNthTableConnectivity(hPrintJob,nTable)
  301.     local cDLL := GetProcAddress(hLibCRPE, "PETestNthTableConnectivity", "Pascal", "bool", "int,int")
  302. RETURN (CallDLL(cDLL,hPrintJob,nTable))
  303.  
  304. ***********************************
  305. **** Pro Version Miscellaneous ****
  306. ***********************************
  307. Function PESetGroupCondition(hPrintJob,nCode,cField,nCondition,nSort)
  308.     local cDLL := GetProcAddress(hLibCRPE, "PESetGroupCondition", "Pascal", "bool", "int,int,str,int,int")
  309. RETURN (CallDLL(cDLL,hPrintJob,nCode,cField,nCondition,nSort))
  310.