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

AV closing popup menus when inside a DLL

edited July 2007 in End User
I have problems implementing ReportBuilder inside a DLL when the
HostApplication is writen in C++

I made a Dll(delphi) with a Form and a TppReport object

The HostApp loads the DLL
Get the ProcAddress of the function
Call the Dll function
The Report Designer or Preview Forms Shows


But when I right click on Designer o Preview Forms (o wherever a popup is
used) the popup menus causes AV erros when they are closed


I saw the RBuilder\Demos\7. DLL example an works fine ..

Is a problem of the new Toolbar2000 ??


Delphi 2007 Update1
RBuilder 10.06 Server
Windows XP sp2

Jame Garza
Cheers

Comments

  • edited July 2007
    Hi James,

    Besides being called from a C++ applicaiton, how is your dll different from
    the demo located in the \RBuilder\Demos\7. DLL\... directory? You mention
    that this demo is working correctly so there must be a slight difference in
    the implementation of the two.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2007
    Hi Nico
    I already send a mail tu support.

    I made an example to reproduce the error, I use the same dll of the demo7
    Only change the call to the function, I use cdecl and the aAppHandle is
    integer but this is always 0

    The Designer shows fine and it looks great but the popups are used very
    often and AV causes I can't operate Designer correctly.


    This is the code of the DLL:

    function ShowForm(aAppHandle: integer): integer; cdecl;
    var
    Form1: TfrmDLL;
    begin
    // use specified app handle or create a new one, as needed}
    if (aAppHandle <> 0) then
    begin
    Application.Handle := aAppHandle
    end
    else
    Application.CreateHandle;

    {create the form}
    Form1 := TfrmDLL.Create(nil);

    {must be modal for DLL calls (never modeless) }
    try
    if Form1.ShowModal = mrOK then Result := 0 else Result := -2;
    finally
    Form1.Free;
    end;

    end;


    Regards
    Jame Garza



  • edited July 2007
    Hi

    I send another mail to support but I have not received answer, I just want
    to know if there will be a solution or if they recibed my mails

    These is an error very very easy to reporoduce ..

    I have one HostApp in C++ and one HostApp in Delphi and just one Dll (with a
    form an ReportBuilder inside)

    Calling the dll from HostAppDelphi - the popups in the designer works fine

    Calling the same dll from HostAppC - the popups in the designer raises an
    access violation when the popups closes

    The calling convention to the function in DLL are the same in both projects,
    the projects are very simple

    These errors not happend in RBuilder 7.04, maybe something with the new
    Toolbar2000 causes these AV

    Or there is a way to use the "old popups" (TPopup) in ReportBuilder, maybe
    these solve the problems

    Can I send to these newsgrou an attachment with these examples ??


    Any help is grateful
    Many Thanks

    James Garza





    "James Garza" escribi? en el mensaje
  • edited July 2007

    - I do not know what is causing the AV. You sent an example to
    support@digital-metaphors.com, but it will run. There are errors about
    missing MFC dll's. We do not use MFC or C++ here at all.

    - when running a Delphi app, there are some VCL initializations that occur
    for the Application object, the controls unit, etc. You can trace the VCL
    source code to see these. Perhaps some of those need to occur when calling
    from the C++ app. Just a guess.

    - If possible try use the debugger to attach to the process and debug the
    code in the Delphi .dll to see where the error occurs and then examine the
    call stack.



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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.