PC Review


Reply
Thread Tools Rate Thread

accessing VC ActiveX from .NET

 
 
Niranjan
Guest
Posts: n/a
 
      22nd Jan 2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing a running ActiveX C# Exe from WebBrowser Tobias Maier Microsoft C# .NET 1 29th Jul 2008 09:58 PM
Accessing Properties ActiveX Charles A. Lackman Microsoft ASP .NET 2 12th Jan 2005 10:13 PM
Accessing ActiveX VB function within C++ App Paul Brun Microsoft VC .NET 1 6th Aug 2004 02:48 PM
accessing managed DLL from ActiveX Adam via .NET 247 Microsoft VC .NET 0 4th Aug 2004 01:48 PM
accessing VC ActiveX from .NET Niranjan Microsoft Dot NET Compact Framework 0 22nd Jan 2004 01:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:50 PM.