Importing COM Components into Visual Studio

Create a new Windows Forms project with Visual Basic and, when ready, open the Visual Studio toolbox. When done, right-click the toolbox and select Choose Items. This launches the same-named dialog that you already know because of adding .NET controls to the toolbox. Select the COM tab and search for the Windows Media Player item, as shown in Figure 49.1.

Figure 49.1 Choosing a COM component to add to the toolbox.

image

When you click OK, Visual Studio generates two files for you:

Interop.WMPLib.dll, which is a CLR wrapper for using COM objects exposed by the Windows Media Player type library in a .NET fashion ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.