Bad Variable exception, when using an ActiveX on WinForm as a seperate Thread.
I have typical problem which i am trying for past 4 days. I am newbie to .NET world.
I have a ocx component which i have to use in C#. So i hosted it on a winform and can use it without problems.
How ever if i make this Winform as a seperate thread and use the same interface which is worked in above case(Winform as not a seperate thread) it is giving BAD VARIABLE TYPE exception.
I have used BeginInvoke and delegate method in MainThread to start execution of the member function in WinForm thread. And in Debug->Threads window i can see thread switch happened without any problems. How ever when we call the interface it throws the exception.
I tried to debug the ActiveX code. It fails in ForwardCalltoInvoke... method. I dont understand why it is ailing in second case, as i pass same variable type in both the cases.
Any help would do great for me.