Migrating Native Code to the .NET Framework

This document provides information about how to migrate existing native code applications to the .NET Framework. This document also provides resources that can help you take advantage of your existing programming knowledge when it is necessary for you to move to the .NET Framework.

The following resources can help you port your existing applications to the .NET Framework.

Migrating from Win32 to the .NET Framework

Migrating from Visual Basic 6.0 to Visual Basic 2010

Migrating from ATL/STL to the .NET Framework

Migrating from the C Runtime (CRT) to the .NET Framework

Migrating from the Microsoft Foundation Classes (MFC) to the .NET Framework

Migrating from ADO to ADO.NET

Migrating from DCOM to the .NET Framework

Migrating from ASP to ASP.NET

Multithreaded Programming

Many native code features of the Windows SDK for Windows 7 and the .NET Framework 4 (later referred to as the Windows SDK) have equivalent or similar counterparts in managed code. This section describes how native technologies are represented in the .NET Framework.

Some features in the Windows SDK that use native code cover a broader scope than the corresponding .NET Framework features. From managed code, to access native features that do not have equivalent implementations in the .NET Framework, use Platform Invoke (P/Invoke) or COM interoperation. You can also use C++/CLI to access managed features from native code. For more information about interoperation between native code and managed code, see Interoperating Between Native Code and Managed Code.

The following table shows the relationships between native features and their managed equivalents.

Windows Technology (Native)

.NET Framework and Other Technologies (Managed)

Remarks

Accessibility

Accessibility

 

Active Directory Service Interfaces (ADSI)

System.DirectoryServices.ActiveDirectory

 

Application recovery

No managed equivalent or wrapper.

 

Audio and video

System.Media, System.Windows.Media

 

Background Intelligent Transfer Service (BITS)

No managed equivalent or wrapper.

For more information, see ClickOnce Deployment for Windows Forms Applications.

Bluetooth

No managed equivalent or wrapper.

 

Collaboration Data Objects (CDO)

System.Net.Mail, System.Net.Mime

 

Component Object Model (COM)

No managed equivalent or wrapper.

Use the System.Runtime.InteropServices namespace to enable COM from the Microsoft .NET Framework.

COM+

System.EnterpriseServices

This namespace wraps the underlying COM+ functionality.

Configuration, instrumentation, logging, security, exception handling

Enterprise Library

For more information, see GotDotNet CodeGallery: Enterprise Library.

Cryptography

System.Security.Cryptography

See also the Enterprise Library Cryptography Application Block.

Debugging

System.Diagnostics

Native applications can load the common language runtime (CLR); see Unmanaged API Reference.

Deployment

ClickOnce Deployment for Windows Forms Applications

 

Devices

.NET Compact Framework

 

Distributed COM (DCOM)

System.Runtime.Remoting

 

Device I/O

Microsoft.VisualBasic.Devices, Microsoft.WindowsMobile.DirectX, Microsoft.WindowsCE.Forms, System.Web.UI.MobileControls, System.Web.Mobile

SetupDi* functions are not available. See also .NET Compact Framework.

Directory services

System.DirectoryServices

 

DLLs, processes, and threads

System.Diagnostics, System, System.Threading

See also AppDomain and BackgroundWorker types.

Domain Name System (DNS)

System.Net

See the Dns type.

Dynamic Host Configuration Protocol (DHCP)

System.Net.NetworkInformation

 

Event logging

System.Diagnostics

See also the Enterprise Library Logging Application Block.

Extensible Authentication Protocol (EAP)

System.Security.Authentication

 

Fax services

No managed equivalent or wrapper.

 

File services

System.IO

 

Function discovery

System.Net.NetworkInformation

 

GDI+

System.Drawing

 

Graphics and media

Managed DirectX, Windows Presentation Foundation

 

HTTP Server

System.Net, System.Web.Hosting

See the HttpListener type.

Image Color Management (ICM)

System.Windows.Media.Imaging, System.Drawing.Imaging

 

Indexing services

No managed equivalent or wrapper.

 

Internet Authentication Service (IAS)

No managed equivalent or wrapper.

 

Internet Connection Sharing and Internet Connection Firewall (ICS/ICF)

No managed equivalent or wrapper.

 

Interprocess communication

System.Runtime.Remoting, System.Runtime.Serialization, System.Web.Services

 

Internet Protocol (IP) Helper

System.Net.NetworkInformation

IP Helper and System.Net.NetworkInformation are similar, but not equivalent, technologies.

Infrared Data Association (IrDA) support

System.Net, System.Net.Sockets

 

Memory management

No managed equivalent or wrapper.

Native applications can load the CLR; see Unmanaged API Reference.

Messaging

Windows Communication Foundation 

For more information, see Getting Started with Windows Communication Foundation.

Message queuing

System.Messaging

The Windows Communication Foundation is built on the System.Messaging namespace.

Messaging Application Programming Interface (MAPI)

System.Messaging, System.ServiceModel

 

Microsoft Data Access Components (MDAC)

System.Data

The System.Data namespace is also known as ADO.NET.

Microsoft Management Console (MMC)

Microsoft.ManagementConsole

Microsoft.ManagementConsole.Advanced

 

Microsoft Speech

System.Speech.Recognition, System.Speech.Synthesis

 

Microsoft Transaction Server (MTS)

System.Transactions, System.EnterpriseServices

 

Monitor configuration

No managed equivalent or wrapper.

 

Microsoft Challenge-Handshake Authentication Protocol (MS-CHAP) password management

No managed equivalent or wrapper.

 

Microsoft XML Core Services (MSXML)

System.Xml

 

Multicast Address Dynamic Client Allocation Protocol (MADCAP)

System.Net.Sockets

 

Native WiFi

No managed equivalent or wrapper.

 

NetShell

No managed equivalent or wrapper.

 

Network Access Protection (NAP)

No managed equivalent or wrapper.

 

Network Address Translation (NAT) Traversal

No managed equivalent or wrapper.

 

Network diagnostics

System.Net.NetworkInformation, System.Diagnostics

 

Network Location Awareness (NLA)

No managed equivalent or wrapper.

 

Network management

System.Net.Configuration, System.Net.NetworkInformation

 

Network Monitor

System.Net.NetworkInformation

 

OpenGL

System.Windows.Media.Media3D, Microsoft.WindowsMobile.DirectX.Direct3D

See also Managed DirectX.

PC Health

No managed equivalent or wrapper.

 

Peer-to-peer networking

System.ServiceModel

The Windows Communication Foundation implements peer-to-peer networking.

Performance monitoring

System.Diagnostics

See also the Enterprise Library for instrumentation solutions.

Power management

System.Windows.Forms, Microsoft.Win32

See the PowerState, PowerStatus, and PowerModes types.

Print schema

System.Printing, System.Drawing.Printing

 

Quality of Service (QOS)

System.Net.Sockets

 

Real-Time Communications (RTC)

No managed equivalent or wrapper.

 

Remote Access Service (RAS)

No managed equivalent or wrapper.

 

Remote Procedure Call (RPC)

System.Runtime.Remoting

 

Restart Manager

No managed equivalent or wrapper.

 

Rights management

System.Security.Authentication, System.Security.Permissions

 

Routing and Remote Access Service (RRAS)

No managed equivalent or wrapper.

 

Security authentication and authorization

System.Security.Authentication, System.Security.Permissions

 

Security management

System.Security.Policy

See also the Enterprise Library Security Application Block.

SetupAPI

System.Deployment.Application

For more information, see ClickOnce Deployment for Windows Forms Applications.

Simple Network Management Protocol (SNMP)

No managed equivalent or wrapper.

 

Still Image (STI)

System.Windows.Media.Imaging, System.Drawing.Imaging

 

Synchronization Manager

System.Web.Mobile

 

System Restore

No managed equivalent or wrapper.

 

System shutdown

System.Windows

See the Application type.

Task Scheduler

No managed equivalent or wrapper.

 

Telephony API (TAPI)

No managed equivalent or wrapper.

 

Terminal Services

No managed equivalent or wrapper.

 

Text Services Framework

No managed equivalent or wrapper.

 

Universal Plug and Play (UPnP)

No managed equivalent or wrapper.

 

Windows clustering

No managed equivalent or wrapper.

 

Windows controls

System.Windows.Forms, System.Windows.Controls

The System.Windows.Forms namespace wraps the Win32 controls from Comctl32.dll. The System.Windows.Controls namespace provides similar functionality by using WPF elements.

Windows File Protection

No managed equivalent or wrapper.

 

Windows Filtering Platform

No managed equivalent or wrapper.

 

Windows Firewall

No managed equivalent or wrapper.

 

Windows Image Acquisition (WIA)

System.Windows.Media

 

Windows Installer

System.Deployment.Application

For more information, see ClickOnce Deployment for Windows Forms Applications.

Windows Internet (WinINet)

System.Net

 

Windows Management Instrumentation (WMI)

System.Management.Instrumentation

 

Windows Messenger

No managed equivalent or wrapper.

 

Windows Multimedia

System.Media, System.Windows.Media

 

Windows NetMeeting

No managed equivalent or wrapper.

 

Windows Networking (WNet)

System.Net

 

Windows Remote Management (WinRM)

No managed equivalent or wrapper.

 

Windows Server Update Services (WSUS)

No managed equivalent or wrapper.

 

Windows Sockets

System.Net.Sockets

 

Windows System Assessment (WinSAT)

No managed equivalent or wrapper.

 

Windows User Interface

System.Windows.Forms, System.Windows

 

Community Additions

ADD
Show: