Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Interop (How Do I in Visual C++)

This page links to help on tasks related to interop using Visual C++. To view other categories of popular tasks covered in Help, see How Do I in Visual C++.

Mixed, Pure, and Verifiable Feature Comparison (C++/CLI)

Compares features across the three difference /clr compilation modes.

How To: Migrate to /clr

Discusses issues that arise when compiling native code with /clr and when converting a project to managed.

How to: Compile MFC and ATL Code with /clr

Discusses how to compile existing MFC and ATL programs to target the Common Language Runtime.

Mixed (Native and Managed) Assemblies

Describes how developers can author applications using a mixture of managed and unmanaged functionality.

Performance Considerations for Interop (C++)

Provides guidelines for reducing the effect of managed/unmanaged interop transitions on run-time performance.

How to: Declare public and private on Native Classes

Shows how to reference a native type from a managed type.

How to: Pass a Delegate^ to a Native Function Expecting a Function Pointer

Shows how, from a managed component, you can call a native function with function pointer parameters where the native function then can call the member function of the managed component's delegate.

How to: Access Characters in a System::String

Shows how to access characters of a String object for high-performance calls to unmanaged functions that take wchar_t* strings.

How to: Add Native DLL to Global Assembly Cache

Describes how to put a native DLL (not COM) into the Global Assembly Cache.

How to: Convert Between System::Guid and _GUID

Shows how to convert between a Guid and a _GUID.

How to: Convert char * String to System::Byte Array

Shows that the most efficient way to convert a char * string to a Byte array is to use the Marshal class.

How to: Convert Standard String to System::String

Shows how convert a Standard C++ Library string (<string>) to a String.

How to: Convert System::String to Standard String

Shows how convert a String to a Standard C++ Library string (<string>).

How to: Convert System::String to wchar_t* or char*

Describes how to use PtrToStringChars in Vcclr.h to convert String to native wchar_t * or char *.

How to: Declare Handles in Native Types

Shows how to create a gcroot object on the native stack.

How to: Determine if an Image is Native or CLR

Shows how to programmatically check whether an image was built for the common language runtime.

How to: Hold Object Reference in Unmanaged Memory

Describes how you can use gcroot.h, which wraps GCHandle, to hold a CLR object reference in unmanaged memory.

How to: Hold Reference to Value Type in Native Type

Describes how to use gcroot on the boxed type to hold a reference to a value type in a native type.

How to: Obtain a Pointer to Byte Array

Describes how you can obtain a pointer to the array block in a Byte array by taking the address of the first element and assigning it to a pointer.

How to: Use a Native Type in a /clr Compilation

Shows how to define a native type in a /clr compilation and any use that native type from within the assembly.

How to: Wrap Native Class for Use by C#

Shows how to wrap a native C++ class so it can be consumed by code authored in C#, or other .NET language.

How to: Marshal ANSI Strings Using C++ Interop

Demonstrates using C++ Interop to marshal ANSI strings between managed and native code.

How to: Marshal Unicode Strings Using C++ Interop

Demonstrates using C++ Interop to marshal Unicode strings between managed and native code.

How to: Marshal COM Strings Using C++ Interop

Demonstrates using C++ Interop to marshal COM strings between managed and native code.

How to: Marshal Structures Using C++ Interop

Demonstrates using C++ Interop to marshal structs between managed and native code.

How to: Marshal Arrays Using C++ Interop

Demonstrates using C++ Interop to marshal arrays between managed and native code.

How to: Marshal Callbacks and Delegates Using C++ Interop

Demonstrates using C++ Interop to marshal callbacks and delegates between managed and native code.

How to: Marshal Embedded Pointers Using C++ Interop

Demonstrates using C++ Interop to marshal embedded pointers between managed and native code.

How to: Specify an out Parameter

Shows how to specify that a function parameter is an out parameter and how to call that function from a C# program.

Using Native COM Servers from .NET

Describes the available options for using existing COM components from .NET applications and outlines the advantages and disadvantages of each approach.

How to: Use Native COM Servers with TLBIMP

Demonstrates how COM objects can be used from managed code using the Type Library Importer (Tlbimp.exe) tool.

How to: Use Native COM Servers with CRCWs

Demonstrates how COM objects can be used from managed code using Custom Runtime Callable Wrappers.

Exposing .NET Framework Components to COM

Describes several tips for writing managed code that interoperates with COM clients.

How to: Marshal Strings Using PInvoke

Explains how native functions that accept C-style strings can be called using the CLR string type System.String using Platform Invoke (P/Invoke) functionality.

How to: Call Native DLLs from Managed Code Using PInvoke

Demonstrates how functions that are implemented in unmanaged DLLs can be called from managed code using Platform Invoke (P/Invoke) functionality.

How to: Marshal Structures Using PInvoke

Explains how native functions that accept C-style structs can be called from managed code using Platform Invoke (P/Invoke) functionality.

How to: Marshal Arrays Using PInvoke

Explains how native functions that accept C-style arrays can be called from managed code using Platform Invoke (P/Invoke) functionality.

How to: Marshal Function Pointers Using PInvoke

Explains how managed delegates can be used in place of function pointers when interoperating with unmanaged functions using Platform Invoke (P/Invoke) functionality.

How to: Marshal Embedded Pointers Using PInvoke

Explains how to marshal embedded pointers using Platform Invoke (P/Invoke) functionality.

How to: Modify Reference Class in a Native Function

Shows how you can pass a reference class with a CLR array to a native function, and modify the class, using PInvoke services.

How to: Parse Strings Using Regular Expressions (C++/CLI)

Describes how you can obtain a pointer to the array block in a Byte array by taking the address of the first element and assigning it to a pointer.

How to: Extend the Marshaling Library

Explains how to extend the marshaling library to provide more conversions between data types.

Using a Windows Forms User Control in MFC

Explains how you can use the MFC Windows Forms support classes to host Windows Forms controls within your MFC applications as ActiveX controls within MFC dialog boxes or views.

Windows Forms/MFC Programming Differences

Provides background information about programming differences between Windows Forms and MFC.

Hosting a Windows Forms User Control as an MFC Dialog Box

Describes how to host a Windows Forms Control as an MFC Dialog Box using the CWinFormsDialog class.

How to: Create the User Control and Host MDI View

Shows how to create a .NET Framework user control, author the user control in a control class library (specifically, a Windows Control Library project), and then compile the project into an assembly.

How to: Add Command Routing to the Windows Forms Control

Demonstrates how to use CWinFormsView to route commands and update command UI messages to the user control to allow it to handle MFC commands.

How to: Call Properties and Methods of the Windows Forms Control

Explains why it is advisable to add a member of the user control type and initialize it in IView::OnInitialUpdate.

Hosting a Windows Forms User Control as an MFC View

Describes how to host a Windows Forms User Control as an MFC View.

How to: Create the User Control and Host in a Dialog Box

Explains how to add a user control to a new dialog-based MFC project.

How to: Do DDX/DDV Data Binding with Windows Forms

Shows how to bind a native C++ string to a .NET user control.

How to: Sink Windows Forms Events from Native C++ Classes

Shows how to enable native C++ classes to receive callbacks from managed events raised from Windows Forms controls or other forms with the MFC macro map format. Sinking events in views and dialogs is similar to doing the same task for controls.

Hosting a Windows Forms User Control in an MFC Dialog Box

Describes how to host a Windows Forms user control in an MFC dialog box.

How to: Do DDX/DDV Data Binding with Windows Forms

Shows how to bind a native C++ string to a .NET user control.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft