I followed the instructions here http://wiki.remobjects.com/wiki/Passing_interfaces_between_Host_and_Plugins
for passing a message from my Delphi 2007 host to my Oxygene WPF VisualPlugin. The Hydra menu Import Interfaces opened the DLL and found the interface and created a file for it in the Delphi app. The Delphi app loads and shows the contents of the visual plugin in the panel I’m feeding it.
Unfortunately, it fails on the QueryInterface call (with e_nointerface error code). Any suggestions?
This is a very simple test app that’s just using the IMessageProcessor interface like in the example.
Thanks, folks. I finally got it all figured out. Yes, it was the visual wrapper thing. But even when I found that section, it took a bit for me to get it right. For posterity, here’s what I wound up with:
namespace HydraGuestTest;
interface
uses
System.Windows,
System.Windows.Controls,
System.Windows.Data,
System.Windows.Documents,
System.Windows.Media,
System.Windows.Navigation,
System.Windows.Shapes,
RemObjects.Hydra,
RemObjects.Hydra.WPF,
RemObjects.Hydra.WPF.Internal,
RemObjects.Hydra.CrossPlatform,
System.Runtime.InteropServices,
RemObjects.Hydra.WPF.Internal;
type
[Guid('45130519-B022-4528-996A-3F2A2E8A4672')]
IMessageProcessor = public interface(IHYCrossPlatformInterface)
method ProcessMessage(Message: String);
end;
[Guid('1D5B9648-30A7-4611-A777-80BE07E70EA1')]
PluginWrapper = public class(VisualPluginWrapper, IMessageProcessor)
private
property PluginInstance: Plugin read Plugin(inherited PluginInstance);
public
method ProcessMessage(Message: String);
end;
[Plugin(), VisualPluginAttribute(), NeedsManagedWrapper(typeOf(PluginWrapper))]
Plugin = public partial class(RemObjects.Hydra.WPF.VisualPlugin, IMessageProcessor)
private
method Button_Click(sender: System.Object; e: System.Windows.RoutedEventArgs);
public
constructor;
method ProcessMessage(Message: String);
end;
implementation
constructor Plugin;
begin
InitializeComponent();
end;
method Plugin.ProcessMessage(Message: String);
begin
DisplayLabel.Content := Message;
end;
method Plugin.Button_Click(sender: System.Object; e: System.Windows.RoutedEventArgs);
begin
(Host as IMessageProcessor).ProcessMessage((new DateTime).Now.ToString);
end;
method PluginWrapper.ProcessMessage(Message: String);
begin
PluginInstance.ProcessMessage(Message);
end;
end.