cancel
Showing results for 
Search instead for 
Did you mean: 

Using PrintEngine (CRPE32.dll) in CR2011 with String type parameter raises 'Error:502 Invalid text of object handle'

Former Member
0 Kudos

Currently we’re using Delhi 7 (VCL compoents) and Crystal Report XI R2 for our Reporting applications. As you may aware of the fact that Crystal Report VCLs is built by wrapping the CR Engine (crpe32.dll routines and data-structures) into various set of object oriented classes framework. (Note: we only use TCRPE compoent that is a pure wrapper of crpe32.dll routines and NEVER used RDC or Viewer control).

Our application is working fine with all the earlier O/Ss including Windows 7 however it’s failing on Windows 8/8.1 or Server 2012. When we researched the problem, we came to know that CR XI R2 wouldn’t work with Windows 8 due to some compatibility issues. Additionally VCLs is not supported by CR anymore however there is a link that provides sufficient information about how to upgrade your VCLs to use higher version of CR. So the only resolution we found so far is to upgrading our CR version from XI R2 to CR 2011 (not even CR 2008 as it also has some issues). Since CR 2011 is the last version that is backward compatible and shipped with PrintEngine library (crpe32.dll and its dependent dlls e.g. pvlocale etc).

I’ve successfully managed to convert the CR-XI VCLs to CR 2011 in Delphi 7. While testing the component, the biggest problem I’m facing is that whenever I try to pass a text/string value to a Parameter then it’s giving me “Error:502 Invalid text or object handle”. Other parameters (I tested only integers, floats, currencies so far) seem to be working fine. We use the following crpe32.dll’s API calls to bind the string parameter:

Call 1) Initializing the PrintEngine using PELoadCrpeDll routine that loads crpe32.dll and its dependent dlls. Then PEOpenEngine, PEOpenPrintJob and PELogOnServer dll calls.

Call 2) Allocating our parameter’s string handle using the following PEGetStringHandle dll routine.

  1. CrpeEngine.PEGetStringHandle(pStrParamValue, HwndStrParam, pStrParamLength) where pStrParamValue = PChar and HwndStrParam = HWND and pStrParamLength=SmallInt.

Call 3) Setting the parameter value using following PEAddParameterCurrentValueW dll routine:

PEAddParameterCurrentValueW(printJob, parameterFieldName, reportName, currentValue)

Where PrintJob = handle to job; parameterFieldName = pWideChar, reportName = pWideChar

and currentValue = PEValueInfoW that contains the following fields (bold-faced fields are assigned with the values returned by the previous calls):

PEValueInfoW = record

    structSize : Word;

    valueType : Word;   {a PE_VI_ constant}

viNumber   : Double;

viCurrency : Double;

viBoolean  : Bool;

viString   : PEVIStringTypeW;

viDate     : PEVIDateOrTimeType; {year, month, day}

viDateTime : PEVIDateTimeType; {year, month, day, hour, minute, second}

viTime     : PEVIDateOrTimeType; {hour, minute, second}

viColor    : DWord;

    viInteger : Smallint; {STRING LENGTH is stored here in case of String type param}

viC        : Char;

ignored    : Char; {for 4 byte alignment. ignored.}

    viLong : DWord;   {STRING HANDLE is stored here in case of String type param}

  end;

THIS CALL IS FAILING with error 'Error:502 Invalid text of object handle'

Has there any major changes done w.r.t. these data-structures and routines in the CR2011 Print Engine (crpe32.dll) that I’m missing? Please see if you could help me resolve this issue or let me know where I can get the development guide?

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

Hi Ravinder

Updating to CR 2011 will not help as you do not have the header file (crpe.H) for CR 2011. And actually, there is no such thing for that version anyhow. Last header file to be released was in version 9 of CR (and this for OEM partners only). The fact that you were able to make things work with CR XI R2 was pure chance and luck.

Your only option is to move your development to CR for VS or CR for Eclipse.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

Ludek,

I believe CR2011 is not purely meant for VS or .NET or Eclipse platforms (it doesn't shipped with any SDK right?). I know that CR stopped supporting VCL components a long ago but still there must be some way to wrap things around like CR for VS or Eclipse.

Anyway, how can achieve the same thing with VS or .NET? Because I think now I have to create a COM component in VS as a wrapper of the CR 2011 and use it in our Delphi 7. I really don't have much choice here. Does it sound right or there is any better way to achieve the same thing? If yes then please guide me what CR components should I wrap as COM component so that our Delphi application be able to preview and print a rpt file?

Additionally, how do we redistribute CR2011? Where can I find its .msm (install merge modules)?

Thanks,

Ravinder

former_member183750
Active Contributor
0 Kudos

CR 2011 does not install any SDK, but the equivalent is SAP Crystal Reports, Developer Version for Visual Studio .NET. Download links are here:

CR for Eclipse is here:

SAP BusinessObjects - SAP Crystal Reports, Version For Eclipse Download

Both are free downloads.

As I mentioned, your best approach is to recreate the app using the CR SDK for .NET. I believe Delphi 7 supports the framework(?).

For info on Delphi and the CR SDK for .NET go here:

Click on the Content tab, then click on the "Blog Posts" link and enter 'Delphi' in the Filter by Tab text box. You will bet a few Blogs by Trevor Dubinsky on how to. Using the search box in the top right corner will not be a bad idea either. I find simple search terms like 'crystal Delphi' get best results.

Oh. Note that since CR 2011 does not install any SDK, there are no MSM, or MIS, or clickonce runtime files...

- Ludek

Message was edited by: Ludek Uher

Former Member
0 Kudos

Ludek,

Like I said earlier, I can't upgrade my application due to some constraints so I really don't have much choice but to look for a better solution. For finding a better solution I have know what are the un-managed languages CR 2011 supports:

1) Does it support VC++ for VS2011? If yes then what are CR components/library/classes we should use to preview/print a .RPT file?

2) Does it support any higher version of Delphi (not .NET derived but un-managed)? If yes then what are CR components/library/classes we should use to preview/print a .RPT file?

If not then the only remaining solution is to using VS.NET or any .NET derived language. How can we achieve the same thing with VS.NET 2012? Because I think now I have to create a COM component or an un-managed regular DLL in VS as a wrapper of the CR 2011 and use it in our Delphi 7. Does it sound right or there is any better way to achieve the same thing? If yes then please guide me what CR components should I wrap as COM component so that our Delphi application be able to preview and print a rpt file?

Additionally, how do we redistribute CR2011? Where can I find its .msm (install merge modules)?

Thanks,

Ravinder

former_member183750
Active Contributor
0 Kudos

1) Does it support VC++ for VS2011? If yes then what are CR components/library/classes we should use to preview/print a .RPT file?

No

2) Does it support any higher version of Delphi (not .NET derived but un-managed)? If yes then what are CR components/library/classes we should use to preview/print a .RPT file?

No

Do not use CR 2011 - no SDK, no wrapper, nothing

- Ludek

Former Member
0 Kudos

Ok. So the only solution we have is to use CR2013 for VS.


Well, now I have to create a COM component in VS as a wrapper of the CR 2013 and use the same in our Delphi 7. Does it sound right or there is any better way to achieve the same thing? If yes then please guide me what CR components should I wrap as COM component so that our Delphi application be able to preview and print a rpt file?

Additionally, how do we redistribute CR2013? Where can I find its .msm (install merge modules)?

Thanks,

Ravinder

former_member183750
Active Contributor
0 Kudos

Sounds right. Be aware that  using COM component in VS as a wrapper is fraught with many pit falls. In the middle ages, maps used to have this warning on the edges of the known world;


There be dragons here.


And this is where you are with wrappers... Use the search box in the top right corner to find more info (simple search term like 'crystal net com wrapper') will be good for starters. Google will also be a good idea.




- Ludek

Former Member
0 Kudos

Thank you Ludek for your help. I greatly appreciate your assistance.


Answers (0)