Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Report Builder 11.07, Delphi 7, IntraBuilder, Richtext control - window handle error

edited March 2010 in General
First, I recently upgraded to Report Builder Enterprise 11.07 (from version
7.04) - specifically for the enhanced PDF support in my windows apps - and
it works great! Old apps using Report Builder work fine with simple
recompilation - no code changes. Thats fantastic. Adding the PDF support was
a breeze as well. Great product.

I have started dabbling with the Intrabuilder that ships in Delphi 7. First,
generally, Report Builder appears to work well with IntraBuilder.

I have run across one issue:

With Delphi 7 Professional, Report Builder Enterprise 11.07, and the
IntraBuilder that ships with Delphi 7:

If the report I am trying to print in an Intrabuilder app includes a
richtext control, the application generates an invalid window handle error -
at two places:

1. Whenever the Intrabuilder application exits, and
2. Whenever I attempt to do a Template.LoadFromFile on a TppReport instance.

If I remove the richtext control from the report - no error is generated in
either place.

I suspect it is probably the same issue - something is trying to free
something and does not have a valid window handle to do the trick - but I
have not had the time to start wading through the code yet. And that is
really not my expertise - so looking for help here.

There are some old threads on the atozed newgroups from a year ago that
suggest the issue may have to do with whether or not the richtext component
is threadsafe - but no final conclusions are drawn. And they have no
solution posted...

So basically, if I use Report Builder 11.07 with Delphi 7 and its
out-of-the-box Intrabuilder, and place a richtext component in my report - I
get this error.

Any help appreciated. Thanks

Comments

  • edited March 2010

    For RB Server Edition we have rich text working on our multi-threaded report
    server, without any errors. You might consider using RB Server Edition to
    implement the reporting for your server app.

    RichText internally relies upon the Delphi TRichEdit control, which itself
    is a wrapper for the windows RichEd DLL. It has to create a windows handle
    to do the rendering. The Windows OS requires Window handles to be destroyed
    in the same thread in which they are created.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2010
    I have thought about the RB Server Edition - however that does include that
    pesky royalty per server- and separate server install and setup - and
    steeper price tag. There is something very sweet about just installing a
    single app - without an additional report server. People here just don't
    even want to deal with the Delphi stuff anymore - particularly when our apps
    are MS SQL server based - and they can do Reporting Services stuff for no
    additional charge per client. If they are going to setup a report server -
    they are going to pick Reporting Services. Setting up Reporting Services is
    a PITA too, though. Setting up for the .NET apps is too... Installing .NET
    3.5, binding it to IIS, copying over all the files needed for .Net app.

    Personally, I would rather avoid all the additional servers to maintain.
    Simple is better. That's why I like Report Builder on the windows platform.
    Its simple.

    Thanks for the information on the RichText controls... So you have RichText
    working in you Server Edition? So I guess you did something special or
    different for the RichEdit controls in the Server Edition that you did not
    do in the Enterprise Edition?


  • edited March 2010


    RB Server is built on top of RB Enterprise - same code base, same
    TppRichText etc. The Report Server supports Form based reports and
    DataModule based reports,. It uses a factory class we defined to manage
    creating/destroying the forms/datamodules and the factory ensures the same
    thread is used for the create/destroy.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2010
    Actually, I think I found a workaround. If after printing any report that
    contains a richtext control (or any report), if I then immediately load a
    dummy template that does NOT contain a richtext control, it apparently
    correctly releases the the window handle, and there is no subsquent issue.

    Oh.. And that should be IntraWeb - not IntraBuilder....

  • edited March 2010
    Rather than load another template, try calling

    Report.Template.New;

    That will clear the existing layout.

    If you also want to free any associated data and code, call

    Report.FreeModules;



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2010
    Good to know! Thanks!

This discussion has been closed.