Hi All,
I have created an ActiveX control using VC 6.0.
One of the interface implements a method which takes in VARIANT FAR*
as the parameter.
Iam unable to call this method from C#(.NET 2003) no matter what..
I can call the same method from VB 6.0.
I have been bogged down by this problem for quite some time.. I dont
have a clue what to do..
The funny thing is that
I created a VB stub (again an ActiveX with method taking byref
Variant), which calls the earlier mentioned VC activex method with the
parameter passed to it.
If I call the above VB method from C# using "ref Object" param it
works fine!!!
Following is the code:
C#
static void Main(string[] args)
{
VBActiveX VB = new VBActiveX();
VCActiveX VC = new VCActiveX();
Object OOO = new object();
VB.TryThis(ref OOO); // This Works!!!
VC.TryThis(ref OOO); // This gives Exception "Catastrophic
failure"
}
VB6
Dim VC as New VCActiveX;
Public Function TryThis(ByRef A As Variant)
VC.TryThis(A) ' This Works!!!
End Function
VC6
short VCActiveX::TryThis(VARIANT FAR* Var)
{
MessageBox( "What is Wrong???", NULL, MB_OK);
return 0;
}
Similar to this problem, I have a third party ActiveX (VC6) which has
a metthod with the same signature(VARIANT *).
On calling this method from C# an exception "Type Mismatch" is raised,
where as from VB6 it works alright????
So where am I going wrong..
thanx a million in advance
Niranjan
|