none
Legacy program can't load activeX component with WPF materials RRS feed

  • Question

  • I have a legacy Delphi program and want to add some content implemented in WPF. So I encapsulate the WPF material with .NET/ActiveX interop technology. That means something like:

    [ComRegisterFunction()]
    public static void RegisterClass(string key);
    [ComUnregisterFunction()]
    public static void UnregisterClass(string key);

    This activeX component is a WinForms User Control and the WPF materials are attached to an ElemenHost in this User Control.

    It works fine if the host app of this ActiveX is a MFC program even without /clr switch. But my legacy app is a delphi program, and it always throw a stackoverflow exception at the first line of the constructor of my WPF user control as the program be started.

    the exception message shows: An unhandled exception of type 'System.StackOverflowException' occurred in PresentationFramework.dll

    I have no clue, Google is no help. It has puzzled me for days.
    Thanks in advance.

    Wednesday, April 14, 2010 1:58 AM

All replies

  • Hi lonelyflyer,

    I am not very sure if this is support for Delphi. Did you develop your Delphi program with CLR? I think it is better for you to add some debug code to catch where the exception happened. If possible, could you please provide more information about your WPF control?

    On the other hand, you could post this to Delphi support forum; hence I believe that the best answer to this question is to contact Delphi support forum:https://forums.embarcadero.com/category.jspa?categoryID=12

    Sincerely,

    Bob Bao


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Thursday, April 15, 2010 4:54 AM
    Moderator
  • Hi Bob,

    Thanks for your replay.

    All the content is the simplest, a simple app, an interoped .NET WinForm UserControl host a WPF UserControl with only a Grid.

    The host app is a native Delphi program and I have tried the native MFC host app without /clr switch and the later works fine. If the WPF content is removed from the .NET ActiveX control, i.e. set the ElementHost.Child to null, all are OK for the Delphi program too.

    I can post this issue to Delphi support forum, whereas I think it is a WPF related issue.

     

    Thursday, April 15, 2010 6:54 AM
  • Hi

    WPF references some unmanage code like milcore, andall display in WPF is done through the DirectX engine.  So I am not sure this possible for hosting a WPF control in the Delphi by ActiveX.

    However, thank you for feeding back your situation and we will try our best to research this issue.

    Sincerely,

    Bob Bao


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Thursday, April 15, 2010 9:41 AM
    Moderator