【www.kwkids.com--二级建造师】
2011年计算机等考二级VB辅导知识技巧总结(9)
Public Declare Function PEOutputToPrinter Lib "crpe32.dll" ( _
ByVal printJob As Integer, _
ByVal nCopies As Integer) As Integer
Public Declare Function PEStartPrintJob Lib "crpe32.dll" ( _
ByVal printJob As Integer, _
ByVal WaitOrNot As Integer) As Integer
Public Declare Function PEClosePrintJob Lib "crpe32.dll" (ByVal printJob As Integer) As Integer
Public Declare Sub PECloseEngine Lib "crpe32.dll" ()
Public Declare Function CreateFieldDefFile Lib "p2smon.dll" ( _
lpUnk As Object, ByVal _
fileName As String, _
ByVal bOverWriteExistingFile As Long) As Long
Public Declare Function vbEncodelPtr Lib "p2smon.dll" (x As Object) As String
Public Declare Function SetActiveDataSource Lib "p2smon.dll" ( _
ByVal printJob As Integer, _
ByVal tableNum As Integer, _
x As Object) As Long
最后给出的是报表的打印代码
Dim Job As Integer
Dim Handle As Integer
"打开打印引擎
Handle = PEOpenEngine
"水晶的错误处理
If Handle = 0 Then
ErrorNum = PEGetErrorCode(Handle)
MsgBox "打印引擎出错!"
MsgBox "错误代号:" & ErrorNum
End If
"打开打印作业