Freigeben über


Enabling network connectivity on a Windows Mobile device emulator

I’ve been experimenting with writing programs for Windows Mobile. I write the code in Visual Studio and use it to run the program in a Windows Mobile device emulator. The app I’m working on needs an internet connection but it is not obvious on how to configure the emulator to make that happen. I came across the following instructions on how the emulator can access the same network connection as the host (dev) machine and though I’d share.

Note: see the end of this post for info on prerequisites and even how to write a managed Windows Mobile application.

Enabling Network Connectivity on the Device Emulator

When Device Emulator is started, it starts like a device that is not cradled. In this state, it has no connectivity to the Internet. There is no data plan provided by a mobile operator. Therefore, the Device Emulator also lacks over-the-air connectivity. There are two ways to enable network connectivity by using Device Emulator:

  • By cradling it by using Windows Mobile Device Center (or ActiveSync in Windows XP)
  • By enabling virtual networking by using the virtual machine network services driver

Note   If the emulator is running inside a virtual PC, see To enable network connectivity on an emulator running inside a Virtual PC.

The following steps describe how to connect the emulator to the Internet by cradling it. This method connects to the Internet by using an ActiveSync pass-through.

To cradle the emulator by using Windows Mobile Device Center (or ActiveSync)

  1. Start Windows Mobile Device Center (ActiveSync 4.5 in Windows XP).
  2. Under Mobile Device Settings, click Connection Settings.
  3. In the Connection Settings dialog box, make sure that the Allow Connections to one of the following check box is selected, and that DMA is selected as the option in the list.
  4. Click OK.
  5. On the Tools menu, click Device Emulator Manager.
    • A green arrow appears next to the emulator that is currently running.
  6. Right-click the emulator instance that is currently running and click Cradle.
  7. In Windows Mobile Device Center, create a guest partnership between the desktop and the device.

- or -

Select Setup your device.

After it is connected, the emulator will have Internet connectivity.

The following steps describe how to connect the emulator to the Internet by using the virtual machine network services driver.

To connect to the Internet by using the virtual machine network services driver

  1. Install the Virtual PC 2007 SP1 client.
    • This installs the virtual machine network services driver and binds the driver to your primary network card.
  2. In Device Emulator, on the File menu, click Configure.
  3. Click the Network tab.
  4. Select the Enable NE2000 PCMCIA network adapter and bind to check box.
  5. In the list, select Connected network card.
  6. Click OK.

If the emulator is running inside a virtual PC, you must perform additional steps to enable network connectivity. We will refer to the physical machine as the host machine and to the operating system running inside Virtual PC as the virtual machine. These instructions assume that the virtual machine is installed and ready to run on the host machine.

To enable network connectivity on an emulator running inside a Virtual PC

  1. Install the Microsoft Loopback Adapter on the host machine.
  2. On the host machine, start Microsoft Virtual PC.
    • The Virtual PC Console appears.
  3. Click Settings to change network settings before starting the virtual machine.
    • The Settings dialog box appears.
  4. Select Networking and then enable two network adapters. Map one of the adapters to the Microsoft Loopback Adapter and the other to the normal adapter (the adapter that is connected to the network).
  5. Click Start to start the virtual machine.
  6. Install the Virtual PC 2007 SP1 on the virtual machine.                                                                                
    • This installs the virtual machine network services driver and binds the driver to your primary network card.
  7. Install the Microsoft Loopback Adapter on the virtual machine.

Make sure that the host and virtual machines are now connected through the Microsoft Loopback adaptor. You can now to connect the emulator to the Internet by using the virtual machine network services driver.

 

For reference, writing a managed Windows Mobile application can be done as follows:

  1. Install required software (these or the latest versions)
  2. Enable network connectivity
  3. Follow walkthrough on creating a simple app in managed code at https://msdn.microsoft.com/en-us/library/bb158524.aspx

Comments

  • Anonymous
    August 01, 2010
    Hi Alex, I know it was a year ago when you posed the above, but can you please fix the link to "To enable network connectivity on an emulator running inside a Virtual PC." As i am really struggling to get this to work.Many thanksChris
  • Anonymous
    October 14, 2010
    thanks a lot for such a useful article. thank you
  • Anonymous
    October 14, 2010
    thanks a lot for such a useful article. thank you
  • Anonymous
    September 20, 2011
    Thanks a ton for the info. Bt i also need the details about how to enable network connectivity on a Windows Phone 7 emulator.
  • Anonymous
    September 13, 2012
    Ok,.This all works excellent on Windows 7. How about Windows 8? It says that you can't install Visrtual PC on windows 8. So is there a way to enable connectivity of the windows mobile device emulator on windows 8?