Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
Anand Balachandran, with contributions by Jim Wilson,
October 2007
Summary
This resource provides sample applications that demonstrate how to use the new Device Emulator Manager automation interface APIs (that are part of Microsoft® Visual Studio® 2008) to configure, and programmatically perform all operations on the installed emulator images that are available interactively on the Device Emulator Manager drop-down and context menus.
Download
Introduction
Two samples are provided. The first is a C++ application that demonstrates how to access the Device Emulator Manager features through the native COM interfaces. The C++ sample application includes two main files that are of interest: DEMAutomation.cpp and DEMOperations.cpp. DEMAutomation.cpp contains the program’s entry point code that parses the command-line parameters and calls the corresponding Device Emulator Manager operation. DEMOperations.cpp contains the code that demonstrates the details of programmatically interacting with the Device Emulator Manager. The two primary interfaces used within the DEMOperations.cpp source file are IDeviceEmulatorManager and IDeviceEmulatorManagerVMID. The IDeviceEmulatorManager interface represents the Device Emulator Manager; the IDeviceEmulatorManagerVMID interface represents a specific instance of an emulator.
The second sample is a script application that demonstrates how to access the Device Emulator Manager features through the Automation interfaces. All Device Emulator Manager features are available through the automation interfaces.
Procedures
-
Open the Visual Studio 2008 DEMAutomation.sln file by clicking Startand then selecting All Programs| Windows Mobile Developer Samples| DEMAutomation| DEMAutomation.
-
In the Visual Studio 2008 Solution Explorer, right-click the DEMAutomationproject and select Properties.
-
In the left-pane of the DEMAutomation Property Pages, expand Configuration Properties, expand C/C++, and then select General.
-
In the right-pane of the DEMAutomation Property Pages, select Additional Include Directories.
-
Verify that the Additional Include Directories value correctly lists the location of the %Program Files%\Microsoft Device Emulator\1.0 folder on your computer. If it is incorrect, modify the value appropriately. The project uses this path to locate the DEMComInterface.tlb type library that the stdafx.h header file imports.
-
Click OKto dismiss the DEMAutomation Property Pages.
-
Build the solution. It will generate the DEMAutomation.exe file.
-
The DEMAutomation.exe application uses command-line arguments to specify the application behavior. See the Usagesection below for the list of supported command-line parameters.
-
Open a command prompt by clicking Start, and then select All Programs, Microsoft Visual Studio 2008, Visual Studio Tools, Visual Studio 2008 Command Prompt.
-
Change directory to the folder where you installed the DEMAutomation.vbs script file. By default, the DEMAutomation Sample installation installs the script file to %Program Files%\Windows Mobile Developer Samples\11-2007 DEMAutomation\Script
-
Type DEMAutomation.vbsand press ENTER.
-
If a message box appears, follow the directions on the message box to correctly execute the script file.
-
Once you successfully execute the DEMAutomation.vbs script, the script will display the command-line arguments used to run the script.
-
See the Usagesection below for the list of supported command-line parameters.
Usage
Following are the command-line parameters supported by both the C++ application and the script file. The application and script file behaviors highlight the features of the Device Emulator Manager automation interfaces.
Note: |
---|
Namein the command-line parameters refers to the display name of the emulator as it appears in the Device Emulator Manager. VMIDrefers to the Virtual Machine Identifier, which is the globally unique identifier for a particular emulator. The easiest way to determine each of the emulator’s VMIDs is to run either the DEMAutomation application or script file with the Listoption, which lists the name and VMID of each installed emulator. |
DEMAutomation
List
bringtofront [VMID|Name]
connect [VMID|Name]
cradle [VMID|Name]
clearsavestate [VMID|Name]
getconfiguration [VMID|Name] [existing device configuration file]
reset [VMID|Name]
uncradle [VMID|Name]
setconfiguration [VMID|Name] [device configuration file to create]
shutdown [VMID|Name]
Conclusion
Information for Managed Developers
The Device Emulator Manager Automation interfaces are accessible through the Microsoft.DeviceEmulatorManager.Interop.9.0.dllinteroperability assembly located in %Program Files%Microsoft Device Emulator\1.0. This assembly provides managed versions of the interfaces demonstrated in the DEMAutomation application. All of the interfaces and classes contained in the assembly are part of the “Microsoft.DeviceEmulatorManager.Interop” namespace.
Note: |
---|
For a detailed discussion of developing managed applications
with the Device Emulator Manager API, see
|