Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to create DCOM dll in c# which i want to utilize or call function from other computer using c# and vb6 application

Same i want to create application using VB6 and want to call in .net application from other as well as same computer.

What I have tried:

I want to create sample application using .NET as well as in VB6, and I want to use those application dll from other computer, I have gone through several steps but it's confusing and still not able to find exact working example.

I have created one sample class library project and signed with key imported by following command:

sn.exe -i C:\Test\D\test.snk testD


and on post-build I am importing file tlb from following command:
%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\RegAsm /codebase "$(TargetPath)" /tlb:"$(TargetDir)$(TargetName).lib"


Now I am able to build project successfully after updating code in AssemblyInfo.cs as follows:

C#
[assembly: ApplicationName("D")] // name space name
[assembly: ApplicationActivation(ActivationOption.Library)]
[assembly: AssemblyKeyFile("test.snk")] // exported key name.


Now I have two files, one dll and one lib file in the bin folder when I build project.

Bow I am confused what to do. How can I access from other computer and how can I create same for VB6.

My project structure as follows
Project Structure

i want to create application which can be installed in different computer also can communicate with each other over network

can any one guide me with steps that how can i create application as well as how can i create setup for the same ?

i have uploaded source code , i am able to create installable config but not able to call from other computer

and this is below my client code with reference
https://www.c-sharpcorner.com/uploadfile/yougerthen/create-dcom-application-from-within-net-environment-part-v/

Type remoteSessionContextType = Type.GetTypeFromProgID("D.Person", "100.10.51.57", true);
var dcomObject = Activator.CreateInstance(remoteSessionContextType);
string version = dcomObject.ToString();
Console.WriteLine(version);

i am getting error as below.

etrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
Posted
Updated 3-Jan-20 2:08am
v4
Comments
F-ES Sitecore 31-Dec-19 13:44pm    
You have to implement COM if you want it used by VB6. Google how to create a COM object in c# and you'll find lots of walkthroughs of all the steps.
Viken Patel 1-Jan-20 0:29am    
yes but i want to create dll which can be called from other machine also i am looking for that solution , if i create dll in COMPUTER A using either vb6 or c# application, which can be called from COMPUTER B.
F-ES Sitecore 1-Jan-20 15:11pm    
If you create it as a COM object you can register it as a DCOM object on the client machine which will allow the object to be created on a different computer.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900