473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Interop with VC dlls

Hi all,

I am new to .net and that c#. I am currently working for a project
that includes migration from vb6 application to c#.

VB6 application communicates with a modules developed in VC++.

Now, the same logic I am trying with c#. That is c# application to
interact with VC++ modules.

I have 2 VC++ dlls, like m1 and m2, in which I used to interact with
class c1 in m1 and class c2 in m2.
something like m1.c1, m2.c2...
In m2.c2, there are functions that needs parameters (byref) of type
ic1.
where ic1 interface which includes all the definitions of m1.c1

Now the current vb6 application passes parameters of type m1.c1 to the
functions in m2.c2 and it is working fine.

But when tried to write the same in c#, it is throwing an error. It is
expecting only parameters of type ic1 interface...

Why is it so? Wont there be any other way to pass that argument of
m1.c1 type????

Thanks,
Swapna.

May 30 '07 #1
4 1452
Swapna,

In VB6, the only way you would be able to work with objects written in
VC++ is through calls to API functions, or through COM. This is the same
way that .NET deals with unmanaged code (although in a much better manner,
IMO). From your post, I can't tell which you are doing.

Can you show some VB6 code in which you are calling your objects?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<sw*************@yahoo.co.inwrote in message
news:11**********************@o11g2000prd.googlegr oups.com...
Hi all,

I am new to .net and that c#. I am currently working for a project
that includes migration from vb6 application to c#.

VB6 application communicates with a modules developed in VC++.

Now, the same logic I am trying with c#. That is c# application to
interact with VC++ modules.

I have 2 VC++ dlls, like m1 and m2, in which I used to interact with
class c1 in m1 and class c2 in m2.
something like m1.c1, m2.c2...
In m2.c2, there are functions that needs parameters (byref) of type
ic1.
where ic1 interface which includes all the definitions of m1.c1

Now the current vb6 application passes parameters of type m1.c1 to the
functions in m2.c2 and it is working fine.

But when tried to write the same in c#, it is throwing an error. It is
expecting only parameters of type ic1 interface...

Why is it so? Wont there be any other way to pass that argument of
m1.c1 type????

Thanks,
Swapna.

May 30 '07 #2
VB6 code is like this

Dim objDataWrapper as DataWrapper.DWrapper
Dim objFrameWorkWrapper as FrameWork.clsFrameWork

public function getData() as long

objDataWrapper = new DataWrapper.DWrapper
objFrameWorkWrapper = new FrameWork.clsFrameWork

getData = objFrameWorkWrapper.getData(objDataWrapper)

end function

In c#, objFrameWorkWrapper.getData() function is expecting the
parameter as IDDataWrapper, which is an interface of
DataWrapper.DWrapper in FrameWork dll.
And if I am trying to create an object of type IDDataWrapper, it is
throwing an error stating "Instance cannot be created for abstract
class or interface".

In Vb6 also, it was expecting the the parameter as IDDataWrapper. But
then if I pass an object of type DataWrapper.DWrapper, it is allowing
and functioning correctly.

What shall I need to do, to achieve the functionality I am expecting.

Thanks,
Swapna.

May 31 '07 #3
And forgot to mention, its VC++ com dll

May 31 '07 #4
Hi all,

I found the solution for my problem in some trial n error.

In c# I have declared the variable as,

FrameWork.InternfaceName objDataWrapper;

objDataWrapper = (FrameWork.InternfaceName) new
DataWrapper.DWrapper();

I dont know whether it is correct or not. But it is working fine for
me.

Regards,
Swapna.

Jun 1 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mike | last post by:
Hi, Using VS 2005, i created a class lib using C#. i compiled this as a dll with the "Register for Com Interop" Option checked. In microsoft access, i am able to create the classes in that dll...
1
by: Shiro | last post by:
Hi I have read the various postings relating to Interop strong name signing and cannot find an example similar to mine. I have stringly named my AxInterops/Interops and they all work just...
8
by: Rob Edwards | last post by:
When trying to add the Microsoft CDO for Exchange Management Library (aka CDOEXM.dll) I receive the following message: "A reference to 'Microsoft CDO for Exchange Management Library' could not be...
2
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability,...
4
by: Philip Wagenaar | last post by:
I am trying to create a vb6 activeX dll in .Net. I used the upgrade wizard in vs.net to load my vb6 project and it converted it to vb.net. Now I know that I have to register the DLL from COM...
9
by: Lloyd Dupont | last post by:
If I write a pure C# application, only using the standart publi API, no interop, the same binary should work well on32 bit, 64 bits and perhaps on the compact framework as well if I link against...
5
by: Yoavo | last post by:
Hi, In my application I have to use som external COM dll's. In the code: using MyDll when I build the project, I get (in addition to the .exe file) a Dll called Interop.MyDll.dll I want to...
1
by: Don.Leri | last post by:
Hi, I have a logger.dll (unmanaged c++ dll compiled in vs2005). I have a C# interop to use that dll in managed code implemented in Interfaces.dll (used by other C# dlls). I also have a...
1
by: Armin Zingler | last post by:
Hi group, after waiting more than 4 month in the .upgrade group for an answer, I dare to ask here. :-) I open a VB6 project in VB 2008 (express) and have the Wizard convert it. It also...
4
by: Just_a_fan | last post by:
I have Googled and done a search in the VB induced help. No answer is apparent. What is the difference of dlls prefixed with Ax and those without? Best I can see, Ax stands for the older...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.