51685086
asked on
Resizing Crystal window opened via API loses the controls at the top of the page
I am using VB6 and Crystal Reports 9.0
I am using the API calls in crpe32.dll for all of my reports
The following code works, but when the report window is resized, the controls disappear
Dim sPath As String
Dim LogOnInfo As PELogOnInfo
Dim TableType As PETableType
Dim sTemp As String
sPath = sReportPath & "Report.rpt"
result% = PEOpenEngine()
If result% = 0 Then
MsgBox "Could not open print engine"
Exit Sub
End If
jobnum% = PEOpenPrintJob(sPath)
errorcode% = PEGetErrorCode(jobnum%)
If errorcode% <> 0 Then
result% = PEGetErrorText(jobnum%, textHandle&, textLength%)
' Get the text from the handle
ErrorText$ = String$(textLength%, 0)
result% = PEGetHandleString(textHand le&, ErrorText$, textLength%)
ErrorText$ = Trim$(ErrorText$)
ErrorText$ = Left$(ErrorText$, Len(ErrorText$) - 1)
MsgBox ErrorText
End If
TableType.StructSize = PE_SIZEOF_TABLE_TYPE
LogOnInfo.StructSize = PE_SIZEOF_LOGON_INFO
result = PEGetNthTableType(jobnum, 0, TableType)
LogOnInfo.ServerName = sServerName
LogOnInfo.DatabaseName = "AB"
LogOnInfo.UserID = "sa"
LogOnInfo.Password = ""
result = PELogOnServer(TableType.DL LName, LogOnInfo)
Dim crdev As crDEVMODE
Dim sD As String, sP As String, sT As String
sD = sWorkDriverName
sP = sWorkPrinterName
sT = sWorkPrinterPort
handle = crPEGetSelectedPrinter(job num, sD, sP, sT, crdev)
handle = crPESelectPrinter(jobnum, sWorkDriverName, sWorkPrinterName, sWorkPrinterPort, crdev)
'Print to preview window
If sOutput = "P" Then
result = PEOutputToPrinter(jobnum, 1)
ElseIf sOutput = "S" Then
result = PEOutputToWindow(jobnum, "Report", 0, 0, IIf(FrmMain.ScaleWidth \ Screen.TwipsPerPixelX > 860, 860, FrmMain.ScaleWidth \ Screen.TwipsPerPixelX), FrmMain.ScaleHeight \ Screen.TwipsPerPixelY, 0, FrmMain.hWnd)
End If
If result <> 1 Then
'DisplayPrintError result, PRJob
Else
'Start print job
result = PEStartPrintJob(jobnum, True)
End If
PEClosePrintJob jobnum%
frmMain, which is passed into the PEOutputToWindow() call above is my MDI parent form.
p.s. This code was ported directly from a previous Crystal Reports 7.0 project and resizing worked fine.
Thank you in advance for any help.
I am using the API calls in crpe32.dll for all of my reports
The following code works, but when the report window is resized, the controls disappear
Dim sPath As String
Dim LogOnInfo As PELogOnInfo
Dim TableType As PETableType
Dim sTemp As String
sPath = sReportPath & "Report.rpt"
result% = PEOpenEngine()
If result% = 0 Then
MsgBox "Could not open print engine"
Exit Sub
End If
jobnum% = PEOpenPrintJob(sPath)
errorcode% = PEGetErrorCode(jobnum%)
If errorcode% <> 0 Then
result% = PEGetErrorText(jobnum%, textHandle&, textLength%)
' Get the text from the handle
ErrorText$ = String$(textLength%, 0)
result% = PEGetHandleString(textHand
ErrorText$ = Trim$(ErrorText$)
ErrorText$ = Left$(ErrorText$, Len(ErrorText$) - 1)
MsgBox ErrorText
End If
TableType.StructSize = PE_SIZEOF_TABLE_TYPE
LogOnInfo.StructSize = PE_SIZEOF_LOGON_INFO
result = PEGetNthTableType(jobnum, 0, TableType)
LogOnInfo.ServerName = sServerName
LogOnInfo.DatabaseName = "AB"
LogOnInfo.UserID = "sa"
LogOnInfo.Password = ""
result = PELogOnServer(TableType.DL
Dim crdev As crDEVMODE
Dim sD As String, sP As String, sT As String
sD = sWorkDriverName
sP = sWorkPrinterName
sT = sWorkPrinterPort
handle = crPEGetSelectedPrinter(job
handle = crPESelectPrinter(jobnum, sWorkDriverName, sWorkPrinterName, sWorkPrinterPort, crdev)
'Print to preview window
If sOutput = "P" Then
result = PEOutputToPrinter(jobnum, 1)
ElseIf sOutput = "S" Then
result = PEOutputToWindow(jobnum, "Report", 0, 0, IIf(FrmMain.ScaleWidth \ Screen.TwipsPerPixelX > 860, 860, FrmMain.ScaleWidth \ Screen.TwipsPerPixelX), FrmMain.ScaleHeight \ Screen.TwipsPerPixelY, 0, FrmMain.hWnd)
End If
If result <> 1 Then
'DisplayPrintError result, PRJob
Else
'Start print job
result = PEStartPrintJob(jobnum, True)
End If
PEClosePrintJob jobnum%
frmMain, which is passed into the PEOutputToWindow() call above is my MDI parent form.
p.s. This code was ported directly from a previous Crystal Reports 7.0 project and resizing worked fine.
Thank you in advance for any help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I tries the sample app and it worked great. I moved the code intact to my app and it didn't work. I finally figured out the problem. I use a control called OT/X for docking forms. Apparently, even deactivated, it still interferes with Crystal. I removed the control from the MDI parent and everything is fine.
Thank you for the effort.
Thank you for the effort.
Glad you got it worked out.
-dave
-dave
ASKER
Thank you for your help vidru. The points are yours!