• Home
  • About
  • BestBloggingIdeas
  • DotNetLearningSource
  • FORUM
  • Joblinks
  • Latest News
  • Policy
  • POSTS
  • SimplySqlServer.Com && SimplyAspDotNet.Com
  • Sitemap

Join Ours Forum

Asp.Net,C#,Ajax,Sql server,silverlight,Javascript codes exambles articles,Programming exambles

RSS Feed
  • Bounty Huge Roll [Amazon Frustration-Free Packaging]
  • XML Introduction to XML VHS Video Training, 1 hr., 32 minutes.
  • The Basic Overview of Windows Mobile Development Asp.Net C#
  • Overview of Sql server extended properties Asp.Net C#
  • How to Use Sql Server Extended properties using visual studio Asp.Net C#
  • Adobe Dreamweaver Templates Accelerate Web Development
  • Top Tips for Web Design Projects
  • How to Achieve a Good Web Design Structure
  • To Use Or Not To Use Website Templates
  • Five Tips to a Successful Website
  • Top 10 Articles,


    Silverlight Datagrid Select Update Delete Insert Asp.Net C#

    Differences Similarities Benefits Between Typed Datasets and Untyped Datasets asp.net c#

    Linq to Sql Introduction Entities Ado.Net C# SqlClasses Attributes Linq Mapping

    Linq Programming/How Linq Works?/Linq Implementation In Asp.Net C# Ado.Net

    Performing Developing Using Investigating Asp.Net 2.0 Ajax Application Development Asp.Net C#

    Hosting/Install Wcf Services in a Windows Service Asp.Net C#

    Connecting Silverlight to Wcf Asp.Net C#

    Silverlight Data Grid Data Binding WCF Asp.Net C#

    Invoking/Accessing/Calling WCF Service Without Adding/Creating Proxy/Reference Asp.Net C#

    Performing Doing Creating Insert Update Delete sql data Using Linq Database Asp.Net C#

    How to Use/Invoke/Access COM Components Using Asp.Net/RCW(Runtime Callable Wrapper)

    Posted by on June 6, 2010 Leave a comment (11) Go to comments

    Introduction:
    In this article i am going to explain about how to use legacy COM components using runtime callable wrappers(RCW)
    ‘s early and late bindings.

    Main:
    I hope,you all learners will accept,before using COM Components we need know the methods and properties in that
    component.

    There are two different techniques that client programs can use to determine this information,”Early Biding” “Late Binding”.

    Early binding allows clients to obtain compile-time type information from the component’s type library. This allows for stronger type checking during compile time.

    A .Net application does not communicate directly with a COM component.it works through manager wrapper of the component.This wrapper, known as a Runtime-Callable Wrapper (RCW), acts like a managed proxy to the unmanaged COM component. It is able to handle the calling of methods on the component, and pass back any return
    values in a form suitable for the CLR.

    We can create the RCW into the following two ways,
    1.using TlbImp.exe utility
    2.From within visual studio .NET

    Creating a wrapper using TlbImp exe:

    TlbImp is shorthand for Type Library Importer. When you execute this program against a COM DLL, it interrogates the COM DLL’s type library and translates the information therein into a .NET format, converting COM standard data types into those recognized by .NET. Once you’ve run TlbImp.exe against a COM DLL, the output
    DLL can be referenced in the usual way like any other assembly by using the /r: compiler option.

    Creating a wrapper using Visual Studio.NET

    To generate a managed metadata wrapper from Visual Studio .NET, you need to use the References dialog, which is available from the Add Reference… option on the
    Project menu. The COM tab displays a list of the components that are registered as COM components on the local machine, and allows us to import COM components to
    use in our .NET project. The Browse button allows you to search the file system for the COM DLL that your .NET project needs.

    How to use TlbImp exe,

    Goto Visual studio Commandline,

    type tlbimp /out: /verbose

    tlbimpexe1

    The verbose option really allows us to display the full download,After created the dll we need to add into com tab for better performance,

    Now i hope you all understood about early binding,its the time we need to talk about late binding,

    Late binding allows us to get the COM info at runtime,For trying late binding,please refer system.Reflection namespace.

    we must know late binding is really dangerous,

    when you late bind a COM component in asp.net application,you call the GetTypeFromProgID() static method of the Type class to instantiate an object representing
    the COM object’s type. The Type class is a member of the System namespace class

    For ex,

    Type SampleType;
    SampleType = Type.GetTypeFromProgID("Component.Method");

    Once you have a Type object encapsulating the COM object’s type information, you use it to create an instance of the COM object itself. This is accomplished
    by passing the Type object to the CreateInstance() static method of the Activator class. CreateInstance() instantiates the COM object and returns a late-bound
    instance to it, which you can store in an object reference.

    object objSample;
    objSample = Activator.CreateInstance(SampleType);

    we can’t invoke methods directly on the object reference. Instead, to talk to the COM object, you have to rely on the InvokeMember() method of the Type object
    that you first created. When you call InvokeMember(), you pass it a reference to the COM object, along with the name of the COM method that you are invoking and
    an object array of any input arguments to that method.

    For ex,

    object[] aryInputArgs = new object[] {number};   //input parameter for particular method,
     
    object objResult = factorialType.InvokeMember("WelcomeString",  //Method name
                                                   BindingFlags.InvokeMethod,
                                                   null,
                                                   objSample, 
                                                   aryInputArgs);
     
    For releasing COM objects,
     
    Marshal.ReleaseComObject(Objsample);
    Conclusion:
    Hope this helps,
    Happy Coding.

    ASP.NET
    ← How to Format/Design Gridview Control Rows using asp.net/c#
    How to Use/Access/Invoke/Perform Active X Controls in Asp.Net/C# Application →

    Learn Easily Using Video Tutorials


    How to choose the right Java IDE – explained Eclipse NetBeans BlueJ

    Developing/Creating/Performing/Configuring Java Applications Using Eclipse IDE

    Step By Step Guide for Download/Install Configure Eclipse IDE for Java

    Editing data with the GridView control Asp.Net C#

    Registering/Configuring Web Controls globally in web.config file asp.net c#

    Registering/Configuring Web Controls globally in web.config file asp.net c#

    Best way to prepare asp.net Interview - Success Stories

    Download Important Questions and PPT's:

    Sql Server Important Questions Online free download

    Dotnet Important Questions Online free download

    Exploring Linq to Sql Process Flow

    Learn how to perform silverlight programming

    Learn OOPs concepts in better and well manner

    Learn Ajax in better and well manner

    Leave a comment

    11 Comments.

    1. can you actually sell lv 1 characters in wow June 8, 2010 at 11:28 pm

      Hey admin, very informative blog post! Pleasee continue this awesome work..

    2. Chelsea FC Jacket June 27, 2010 at 4:24 am

      Thanks very good for report, I follow your blog:-)

    3. Legalsounds July 17, 2010 at 5:51 pm

      Wow!, this was a top quality post. In theory I’d like to write like this too – taking time and real effort to make a good article… but what can I say… I procrastinate a lot and never seem to achieve anything

    4. Elias Haken July 25, 2010 at 1:36 am

      This might be some thing I may certainly look into.

    5. Elyse Anania July 29, 2010 at 1:30 am

      Thanks for sharing. I enjoyed reading your article!

    6. Rickie Basini July 31, 2010 at 8:06 pm

      Thanks for sharing information with us. it is very useful to me.

    7. PreenCeri August 13, 2010 at 7:19 am

      Good brief and this enter helped me alot in my college assignement. Gratefulnes.

    8. wedding maid of honor August 15, 2010 at 3:58 pm

      I truly loved this brilliant article. Please continue this awesome work. Regards, Duyq.

    9. Leslee Lossing October 31, 2010 at 11:03 pm

      This blog seems to get a great deal of visitors. How do you promote it? It offers a nice individual twist on things. I guess having something real or substantial to post about is the most important thing.

    10. hydrogen rich water stick January 4, 2011 at 2:38 pm

      Grover says that this is a good find, He’s going to invite all of his friends.

    11. bg February 18, 2011 at 10:35 am

      very nice article :shock:

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    *

    *


    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    Enter your email address:

    Delivered by FeedBurner

    • Recent Posts

      • Bounty Huge Roll [Amazon Frustration-Free Packaging]
      • XML Introduction to XML VHS Video Training, 1 hr., 32 minutes.
      • The Basic Overview of Windows Mobile Development Asp.Net C#
      • Overview of Sql server extended properties Asp.Net C#
      • How to Use Sql Server Extended properties using visual studio Asp.Net C#
    • Search by Tags!

      Application AspNet Basic between Black Bluetooth Build Business Collection Consultants Design Development Downloading effective Excel Experts Generics Implement Installing Interview Logic Management Microsoft Minutes Object Outlook Professional Programmer Programming Project Projects Questions Ready Select Server Services Silverlight Source Strings Studio Through using Visual Website Wordpress
    • Archives

      • August 2011
      • June 2011
      • May 2011
      • April 2011
      • March 2011
      • February 2011
      • December 2010
      • November 2010
      • October 2010
      • September 2010
      • August 2010
      • July 2010
      • June 2010
      • May 2010
      • April 2010
      • March 2010
      • February 2010
      • January 2010
      • December 2009
      • November 2009
      • October 2009
      • September 2009

    Copyright © 2012 NetProgrammingHelp.com

    Δ Top