Solved

Resizing Crystal window opened via API loses the controls at the top of the page

Posted on 2004-10-17
7
498 Views
Last Modified: 2012-05-05
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(textHandle&, 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.DLLName, LogOnInfo)
 
  Dim crdev As crDEVMODE
  Dim sD As String, sP As String, sT As String
 
  sD = sWorkDriverName
  sP = sWorkPrinterName
  sT = sWorkPrinterPort
   
  handle = crPEGetSelectedPrinter(jobnum, 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.
0
Comment
Question by:51685086
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 250 total points
ID: 12336284
According to my references, the CRPE32 method is considered legacy.  It may still work but is no longer supported for Crystal 9.  I don't have my Crystal 8 reference here.  I'll look it up in the morning to see if there is a change between CR7 and CR8.

mlmcc
0
 
LVL 13

Assisted Solution

by:vidru
vidru earned 250 total points
ID: 12336350
If it helps, I took the code from here...

http://support.businessobjects.com/communityCS/FilesAndUpdates/crpedemo.exe.asp

..., update the global32.bas with the one that shipped with CR9, update it to incorporate an MDI form and your PEOutputToWindow statemen, and was NOT able to reproduce the behavior you describe.

I haven't used the API at all.  If I wasn't eyeballs deep in other stuff, I'd try to do some more digging for you.  Gook luck.

-dave
0
 

Author Comment

by:51685086
ID: 12347102
I tried to add the global32.bas but I obviously have the same functions in other modules. But, since the global32.bas file is clearly different than the one I have and you can't duplicate my issue, I think you're right. It will probably take me a few days to implement the new file correctly.

Thank you for your help vidru. The points are yours!
0
 

Author Comment

by:51685086
ID: 12363893
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.
0
 
LVL 13

Expert Comment

by:vidru
ID: 12364112
Glad you got it worked out.

-dave
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question