|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
SummaryThis article explains step by step of accessing COM+ application using C#. The code is compiled using beta2. Microsoft (R) Visual C# Compiler Version 7.00.9254 [CLR version v1.0.2914]. It can be used with Beta1 with some minor modification. If we want need to access the existing COM+ application with any .net supported language, we don't need to modify the single line of existing COM+ application, despite of the fact their execution model is completely different. Here is the step-by-step easy example of doing the same. We can access it in two ways, Early Binding and Late binding (remembered the old VB concepts). We will first look at Early binding example... Early BindingTools Required
Let's Start
To use existing COM+ application we need create Runtime Callable Wrapper (RCW) using Let us assume that we have a COM Component with a method Add, which takes two parameter A and B and returns the Sum. Note: We have to register COM DLL first before using it...'CompAdd.Dll (class1) Public Function Add(A As Long, B As Long) As Long Add = A + B End Function
Now we will run
This generated a wrapper dll CompAddRcw.dll. we can view this DLL using
The discussion in
As we can see that we are getting the same kind of
tooltip as we used to get with VB when we do early binding. Compile the program with /r:
switch e.g. Late BindingFor Late binding we have to useSystem.Reflection namespace, which allows us
to programmatically access the types contained in any assembly. We will see how
we can do late bindings in four easy steps..
The method ConclusionThis article gives very basic idea of using the old COM Application, for the purpose of simplicity and to focus on the purpose of the article no error handling has been done. In my next article we will see how can we use .NET component with VB.
|
||||||||||||||||||||||