iMacros component: Calling and recursion protocol

Discussions and Tech Support related to using the iMacros Component for .NET in your applications.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
BGood
Posts: 19
Joined: Thu Mar 31, 2011 2:23 am

iMacros component: Calling and recursion protocol

Post by BGood » Fri Aug 19, 2011 7:22 pm

In my test integration of the iMacros component with my application, I created a class which closely follows the structure of the sample TestComponent_VB/Form1.vb. My code-behind has a new() constructor which instantiates the iMacros component and adds the control to a windows.forms.container control as follows:

#Region "iMacros"
Public Sub New()
InitializeComponent()
iim = iMacrosControl.Create("myKey")
iim.Dock = DockStyle.Fill
SplitContainer1.Panel2.Controls.Add(iim)
AddHandler iim.BrowserStatusUpdated, AddressOf iim_BrowserStatusUpdated
End Sub ...

The calling protocol I typically use for windows forms is class.show() or class.showdialog(), but because it appears that the iMacros component requires initialization via constructor, I am activating the form as follows:

Dim frm As New iMacrosForm
frm.ShowDialog()
frm.Dispose()

I have tried this several different ways, but the problem I am having is that the iMacrosForm instance runs fine the first time it is called, but after the form is closed, if the form is activated again I get the following runtime error:
System.Runtime.InteropServices.InvalidComObjectException was unhandled
Message=COM object that has been separated from its underlying RCW cannot be used.
Source=mscorlib
I have tried calling dispose() in the close event of the form and elsewhere and presume that I am invoking the iMacros form improperly. Is there some additional documentation on how to do this? Thanks.
Marcia, Tech Support
Posts: 1095
Joined: Thu Jan 29, 2009 1:10 pm

Re: iMacros component: Calling and recursion protocol

Post by Marcia, Tech Support » Mon Sep 12, 2011 7:01 am

Hello,

Thank you for pointing this out.

The fix for this issue is going to be available in the next Component release (version 7.50)
Regards,

Marcia
Post Reply