CMMI,.NET,JAVA,Networking,Oracle,SQL Server, Testing Questions And Answers

Home| Forums | Join Google Group | Join Yahoo Group | Jobs
Get custom programming done at GetAFreelancer.com!
Earn Money
  Trading Forex Online
  Paramount Airways
  Free Data Recovery
 Cargo
 Job Portal
  HSBC Investment
 Management
 Cheap Web Hosting
  Make Trip
  Cheap Air Travel
 Leisure Hotel
  Free Air Travel
  Mutual Fund Informations
   Cheapest Cellular Plan
 Free Sexy Indians
  Call Center Software
  Hot Indian
Programming Help | Homework Help | Counseling
Astrology Advice | Tarot Advice | Parenting
Dating Advice | Love Advice | Divorce Advice
Legal Advice | Debt Advice | Career Advice
Runtime Technical Questions
Interoperability
Can I use COM objects from a .NET Framework program?
Yes. Any COM component you have deployed today can be used from managed code, and in
common cases the adaptation is totally automatic.
Specifically, COM components are accessed from the .NET Framework by use of a runtime
callable wrapper (RCW). This wrapper turns the COM interfaces exposed by the COM
component into .NET Framework-compatible interfaces. For OLE automation interfaces, the
RCW can be generated automatically from a type library. For non-OLE automation interfaces, a
developer may write a custom RCW and manually map the types exposed by the COM interface
to .NET Framework-compatible types.

Can .NET Framework components be used from a COM program?
Yes. Managed types you build today can be made accessible from COM, and in the common
case the configuration is totally automatic. There are certain new features of the managed
development environment that are not accessible from COM. For example, static methods and
parameterized constructors cannot be used from COM. In general, it is a good idea to decide in
advance who the intended user of a given type will be. If the type is to be used from COM, you
may be restricted to using those features that are COM accessible.
Depending on the language used to write the managed type, it may or may not be visible by
default.
Specifically, .NET Framework components are accessed from COM by using a COM callable
wrapper (CCW). This is similar to an RCW (see previous question), but works in the opposite
direction. Again, if the .NET Framework development tools cannot automatically generate the
wrapper, or if the automatic behavior is not what you want, a custom CCW can be developed.

Can I use the Win32 API from a .NET Framework program?
Yes. Using platform invoke, .NET Framework programs can access native code libraries by
means of static DLL entry points.
Here is an example of C# calling the Win32 MessageBox function:
using System;
using System.Runtime.InteropServices;

class MainApp
{
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);

public static void Main()
{
MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );
}
}
Earn Money
  Trading Forex Online
  Paramount Airways
  Free Data Recovery
 Cargo
 Job Portal
  HSBC Investment
 Management
 Cheap Web Hosting
  Make Trip
  Cheap Air Travel
 Leisure Hotel
  Free Air Travel
  Mutual Fund Informations
   Cheapest Cellular Plan
 Free Sexy Indians
  Call Center Software
  Hot Indian