Share via


How To: Create a Project that Uses Device Emulator Manager Automation Interfaces

Use the following steps to create a Visual C++ Win32 Console application that programmatically starts and controls the Device Emulator Manager (DEM). The application controls the DEM by using the DEM Automation interfaces.

By using these interfaces, you can programmatically enumerate, start, cradle, uncradle, and shutdown device emulators on your computer. These interfaces are typically used by quality assurance (QA) teams that have to automate testing on many emulators.

To create a project that uses Device Emulator Manager Automation Interfaces

  1. Create a Visual C++ Win32 Console project.

    1. Start Visual Studio

    2. On the File menu, point to New, and then click Project.

      The New Project dialog box appears.

    3. Expand Visual C++, and then click Win32.

    4. Click Win32 Console Application in the Templates pane, name the project DEMSample, and then click OK.

      The Win32 Application Wizard appears.

    5. Click Next.

    6. In the Application Settings page, check ATL and then click Finish.

      The new project is created and displayed in Solution Explorer.

  2. Add Microsoft Device Emulator to the project's included directories.

    1. Right-click DEMSample in Solution Explorer and then click Properties.

      The DEMSample Property Pages dialog box appears.

    2. Expand Configuration Properties and then click C/C++.

    3. Next to Additional Include Directories, add the folder of Microsoft Device Emulator and then click OK.

      The default location is drive:\program files\Microsoft Device Emulator\1.0.

  3. Import the import Automation interfaces.

    1. Double-click stdafx.h in Solution Explorer to open it in the Code Editor.

    2. Add the following code at the end of the file:

      #import "DEMComInterface.tlb" no_namespace raw_interfaces_only
      
  4. Use IDeviceEmulatorManager in the application's main method.

    1. Double-click DEMSample.cpp in Solution Explorer to open it in the Code Editor.

    2. Just above return 0; in the main method, add the following code:

  5. On the Debug menu, click Start Debugging.

    The program starts the Device Emulator Manager and then calls IDeviceEmulatorManager::ShowManagerUI so that it is visible.

See Also

Other Resources

Device Emulator

Device Emulator Samples