Device emulator sharing source code first experience (2)

Source: Internet
Author: User
It is easy to make device emulator run normally after the program is compiled. However, this seemingly "easy" event took an afternoon. By the way, we also talk about the command line startup method of the simulator.
The "How to Build" document in the simulator Code does not provide a detailed description. If a compiled simulator is started, the command line of the simulator is basically the same as that of device emulator 1.0. So I found this article on the Internet, "How can I launch the smartphone 2002 emulator without EVT?", The connection is as follows: http://www.smartphonedn.com/qa/emulator_launch.html
The device emulator we use in Visual Studio 2005 and the simulator used in Visual Studio 2003, EVC 4.0, and EVT 3.0 are two different applications, the former is to compile the arm instruction JIT into x86 instruction execution, which is why the simulator of VS 2005 can install some arm instruction applications, while the latter is through cross-compilation, compile the code into an x86 command and run it on the simulator. So the latter is simpler, and the two simulators are slightly different in terms of command line, which is also the biggest cause of the problem.
The simulator in visual stuido 2003 is called "pbemulator". We can go to X: /program files/Windows CE tools/wce420/Pocket PC 2003/emulation path (X indicates the drive letter for your Pocket pc sdk installation), find a file named Emul. CMD batch processing. This is how vs 2003, EVC, and EVB start the simulator.
Start "D:/program files/common files/Microsoft shared/Windows CE tools/platman/bin/pbemulator.exe"/memorysize 64/fastbackground/skin "D: /program files/Windows CE tools/wce420/Pocket PC 2003/Emulation/pocket_pc_emulator_skin.xml "/ceimage" D: /program files/Windows CE tools/wce420/Pocket PC 2003/Emulation/ppc_2003_wwe.bin "/vmname" Pocket PC 2003-Pocket PC 2003 emulator "/hostkey 165
Here, we note that the/ceimage and/Skin options specify the image address to be called by the simulator and the address of the skin configuration file respectively. In fact, these two options are available, the simulator can be started normally.
However, the problem lies in that the deviceemultor command line methods of Visual Studio 2005 are not the same, and the help file does not provide detailed descriptions. If you double-click deviceemulator.exe (X:/program files/Microsoft device emulator/1.0), a dialog box is displayed, prompting the command line parameters. Finally, the command line for successful experiments is as follows:
Start "C:/program files/Microsoft device emulator/1.0/deviceemulator.exe" "D: /program files/Microsoft Visual Studio 8/smartdevices/emulators/images/pocketpc/2003/1033/ppc_2003_se_wwe_armv4.bin "/skin" D: /program files/Microsoft Visual Studio 8/smartdevices/skins/pocketpc_2003/pocketpc_2003/1033/pocketpc_2003_skin.xml"
We want to use the BIND file of the arm instruction of the Pocket PC 2005 self-contained in Visual Studio 2003, instead of the binfile contained in the previous SDK. The bitfile prompted in the deviceemultor command line should never be written into bitfile in the command line. Instead, you can write the full path of the binfile into it. I made a mistake here. The/skin and pbemulator are the same. If you want to check the command line parameters of deviceemultor, you can find the "device emulator command line reference" in the help of deviceemultor"
After understanding the deviceemultor command line parameters, it will not be difficult to start the simulator. You can directly specify the command line parameters in the deviceemultor project. Select "project"> "properties", select debuggin of configuration properties in the pop-up menu, and add the following command lines to the command arguments item on the right.
"D:/program files/Microsoft Visual Studio 8/smartdevices/emulators/images/pocketpc/2003/1033/ppc_2003_se_wwe_armv4.bin"/skin "D: /program files/Microsoft Visual Studio 8/smartdevices/skins/pocketpc_2003/pocketpc_2003/1033/pocketpc_2003_skin.xml "/memsize 64
 
After the configuration is complete, select F5 to enter the debug mode and run deviceemultor. however, the deviceemultor will prompt error: System Resources Exhausted. I compiled it in XP SP2 in Chinese and Visual Studio 2005 in English. I don't know if this error is caused by the language environment.
After repeated tracking code, it is determined that the error occurs when the menu resource is loaded in the lcdthreadproc function of the iowincontroller class on line 1 of wininterface. cpp. So I commented out the exit (1); Code in line 493. Then compile and run the simulator.
As you can see, the running simulator does not have a menu. We need to solve this problem later, but the overall running of the simulator is still normal.
I have to sigh a few words here. When I used some open source class libraries in the past, all kinds of settings, cutting, and compilation are required for the light-guide to the development environment. After the compilation is successful, to run normally, you still need to modify n pieces of code. We must acknowledge that Microsoft still has a good tradition of product release. According to the instructions in the document, there was no unexpected error in the compilation process, but only one Code was modified during the running process. This is indeed rare. This also reflects from another aspect, a mature software company's good style in code management. This is indeed worth learning. If you provide code to colleagues or users, you can have a guide document that can be compiled within one day and added to your project. If that is the case, you have done a good thing.
 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.