Call a .NET dll in Eclipse [message #925206] |
Thu, 27 September 2012 13:46 |
Ravi Kotha Messages: 1 Registered: September 2012 |
Junior Member |
|
|
Hi,
I am working in an eclipse PDE where i need to have a COM dll created in VB.NET to be loaded in my current project.
I already have a VC++ COM dll working but the same is not working with the .NET COM dll.
The working snippet of the VC++ COM dll is below:
OleFrame frame = new OleFrame(parent, SWT.V_SCROLL | SWT.H_SCROLL);
sim = new OleControlSite(frame, SWT.NONE, "SimulatorGUI.SimulatorGUICtrl");
sim.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
sim.doVerb(OLE.OLEIVERB_SHOW);
this.setPartName("Track Layout");
mSimIntf = new OleAutomation(sim);
This works great but when i replace the same with my dll prog id instead it does not work and throes an error saying "Could not create the view: Failed to create Ole Client. result = -2147467262"
My VB.NET is fine and properly exported to COM. See the snippet of the same below for reference:
Imports System
Imports System.Runtime.InteropServices
Namespace SIMIICOMComponent
<Guid("D2964724-F498-4ad3-8089-4B8FFCAAA8B8"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface _ISIMCOMClass
<DispId(1)> Function MlFileInput(ByVal FileName As String) As System.Windows.Forms.Form
<DispId(2)> Sub Load()
End Interface
<Guid("776176c4-cec0-4a6a-b3d5-e039a72029e1"), _
ClassInterface(ClassInterfaceType.None), _
ProgId("SIMIICOMComponent.SIMIIComClasss")> Public Class SIMIIComClass
Implements _ISIMCOMClass
Private frm As frmMain
Public SIMIIComClass()
Public Function MlFileInput(ByVal FileName As String) As System.Windows.Forms.Form Implements _ISIMCOMClass.MlFileInput
frm = New frmMain
frm.FileName = FileName
Return frm
End Function
Public Sub Load() Implements _ISIMCOMClass.Load
frm.LoadProgram(frm.FileName, False)
End Sub
End Class
End Namespace
Please help resolve this issue.
Regards,
Ravi
|
|
|
Re: Call a .NET dll in Eclipse [message #929843 is a reply to message #925206] |
Mon, 01 October 2012 20:32 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
SWT just makes the required native COM calls, so if it's working for
your C++ case then there doesn't seem to be an SWT problem here.
COM error code -2147467262 is "No such interface supported", so
presumably it's a problem with your VB.NET-created .dll, either it's not
registering a component, or it's not registering an interface that a
component needs to be supporting. Maybe someone with more VB.NET
experience than myself can spot the problem.
Grant
On 9/27/2012 9:46 AM, Ravi Kotha wrote:
> Hi,
>
> I am working in an eclipse PDE where i need to have a COM dll created in
> VB.NET to be loaded in my current project.
> I already have a VC++ COM dll working but the same is not working with
> the .NET COM dll.
>
> The working snippet of the VC++ COM dll is below:
> OleFrame frame = new OleFrame(parent, SWT.V_SCROLL | SWT.H_SCROLL);
> sim = new OleControlSite(frame, SWT.NONE, "SimulatorGUI.SimulatorGUICtrl");
> sim.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
> sim.doVerb(OLE.OLEIVERB_SHOW);
> this.setPartName("Track Layout");
> mSimIntf = new OleAutomation(sim);
>
> This works great but when i replace the same with my dll prog id instead
> it does not work and throes an error saying "Could not create the view:
> Failed to create Ole Client. result = -2147467262"
>
> My VB.NET is fine and properly exported to COM. See the snippet of the
> same below for reference:
>
> Imports System
> Imports System.Runtime.InteropServices
>
> Namespace SIMIICOMComponent
>
> <Guid("D2964724-F498-4ad3-8089-4B8FFCAAA8B8"), _
> InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
> Public Interface _ISIMCOMClass
> <DispId(1)> Function MlFileInput(ByVal FileName As String) As
> System.Windows.Forms.Form
> <DispId(2)> Sub Load()
>
> End Interface
>
> <Guid("776176c4-cec0-4a6a-b3d5-e039a72029e1"), _
> ClassInterface(ClassInterfaceType.None), _
> ProgId("SIMIICOMComponent.SIMIIComClasss")> Public Class SIMIIComClass
> Implements _ISIMCOMClass
> Private frm As frmMain
> Public SIMIIComClass()
>
> Public Function MlFileInput(ByVal FileName As String) As
> System.Windows.Forms.Form Implements _ISIMCOMClass.MlFileInput
> frm = New frmMain
> frm.FileName = FileName
> Return frm
> End Function
>
> Public Sub Load() Implements _ISIMCOMClass.Load
> frm.LoadProgram(frm.FileName, False)
> End Sub
> End Class
>
> End Namespace
>
> Please help resolve this issue.
>
> Regards,
> Ravi
>
|
|
|
Powered by
FUDForum. Page generated in 0.03974 seconds