Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / June 2005

Tip: Looking for answers? Try searching our database.

.NET called as COM interface

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave Braithwaite - 21 Jun 2005 18:41 GMT
I'm having trouble getting my head around calling .NET components from
legacy VC6.

I need to implement a logging "thing" (service, object, application,
whatever) in C# that will be called by legacy vc6 code.  This "thing" will
need to:

- log messages from client applications to an SQL Server (MSDE) database
- minimise performance hit to client applications
- raise events after log messages are written to the database
- manage and limit connections to database given that its MSDE.
- support lots of potential simultaneuos connections from client
applications (say 20).

I believe I need to employ the COM interop services so that my client
applications can call into the .NET logging thing using COM.

I think I need to implement a global message queue.  This will be serviced
by a thread that will pull log messages off one-by-one and add them to the
database raising events as it goes.  I will also need some form of object(s)
that can be called by the client applications to place messages on this
queue.

I've had a look at c# objects exposed via CCW, COM+ and Window Services.
And am a little confused.  Can someone, anyone, give me some pointers as to
how to proceed with all of this ?
Nassos - 22 Jun 2005 13:53 GMT
Hi Dave,
Create a dll using c# and then use CreateObject from VB, you will not have
autoComplete, but this is a minor problem.
Hope that Helps
> I'm having trouble getting my head around calling .NET components from
> legacy VC6.
[quoted text clipped - 24 lines]
> to
> how to proceed with all of this ?
dbraithwaite@lkuk.co.uk - 24 Jun 2005 08:34 GMT
Can you expand some please ?
Nassos - 27 Jun 2005 09:11 GMT
Sure man , but bear with me cos my VB suck,
lets say that you build a Dll library with .NET called Test and contains 2
classes class1 and class 2 be carfull there is a option in vs.NET that allow
your dll to have com interoptability and produces a tlb file as well as a
dll, after you build your dll run cmd (Command prompt) and run regasm for
your tlb and dll, this will finish the NET part.
Now in the vb6 do:
Dim obj as Object
set obj = CreateObject("Test","Class1")
now this object obj has the methods and attributes of the Class1 class in
the Test dll, but if you type:
obj.Start() if the method Start exist, cos when you press the dot you will
NOT have a list of the available methods and attributes, it will run the
method and if doesn't exist it will NOT produce an error.
Hope that helps

> Can you expand some please ?
Nassos - 27 Jun 2005 09:18 GMT
here is a microsoft link for making a NET dll and call it as COM
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/c
allnetfrcom.asp

CU
> Sure man , but bear with me cos my VB suck,
> lets say that you build a Dll library with .NET called Test and contains 2
[quoted text clipped - 13 lines]
>>
>> Can you expand some please ?
dbraithwaite@lkuk.co.uk - 28 Jun 2005 10:46 GMT
Thanks for the help.

In the end, I decided to ditch C# and go back to good old (unmanaged)
C++ as an ATL server.  I've implemented pretty much all I specified in
the post.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.