Windows CE下開機自動運行程式

來源:互聯網
上載者:User
 

How to Configure the Registry to Run an Application at StartupYou can add an application to your OS design and then configure the registry to run the application when your run-time image boots. By doing so, you can decrease the amount of time involved in debugging an application. Otherwise, after your run-time image boots, you must manually load and run the application on your target device. Note   This procedure requires you to have already created an application. For information about creating and building an application in the context of using Platform Builder with a CEPC, see Tutorial: Building a Run-Time Image for a CEPC.To track your progress, select the check box next to each step.
  Step Topic
1. Open an existing OS design, or create a new one, and then build and download the run-time image to a target device. How to Use the IDE to Create, Customize, and Build a Run-Time Image
2. Use the Remote Registry Editor to discover the HKEY_LOCAL_MACHINE/Init launch numbers for each .exe file that runs on the target device at startup. To run your application at startup, assign launch numbers to your application's .exe files in the HKEY_LOCAL_MACHINE/Init section of the registry of the target device.
  • Connect to your target device using the Remote Registry Editor.
If the connection fails, see Configuring the Connection to a Target Device Using Platform Manager.
  • In the Windows CE Remote Registry Editor window, expand the Default Device node, then the HKEY_LOCAL_MACHINE node, and then the Init node.
  • In the right pane, in the Name column, note the launch number for each application.
These numbers use the launchnn format, where nn is the launch number.
Opening Remote Registry Editor Connecting to a Target Device with a Remote Tool
3. Add the application to your OS design as a project. Adding an Existing Project to an OS Design
4. Create a registry entry in the HKEY_LOCAL_MACHINE/Init section of the Project.reg file for your application. Configuring a Registry File to Run an Application at Startup
5. Build the changed Catalog items in your OS design. Building a Run-Time Image Building a Selected Project
6. Configure a connection between your development workstation and your target device. Note   Debugging is not necessary at this point.If your target device is a CEPC, boot your run-time image on the CEPC. For more information, see How to Configure and Download a Run-Time Image to a CEPC. If your target device is the Emulator, download your run-time image to the Emulator.For more information, see Downloading a Run-Time Image to the Emulator. Configuring a Connection for Downloading and Debugging
7. When the download process is complete, verify that the application launched properly on your target device. The time required to display the OS depends on the size of the downloaded run-time image. Not applicable
 Configuring a Registry File to Run an Application at StartupYou can configure a registry (.reg) file to run a module when your run-time image starts up. There are two ways to configure registry files:
  • Modify the registry file before building and downloading the run-time image.
  • Use the Remote Registry Editor after downloading the run-time image to the device.
Using the Remote Registry Editor changes the run-time image registry, but the changes are not persisted to the registry files in Platform Builder. The next time you download the run-time image, you must configure the registry again. For more information, see Remote Registry Editor. To modify a registry file in the IDE
  1. From the Workspace window, choose the ParameterView tab at the bottom of the window.
  2. Expand the nodes until you find the folder for the target device you have chosen.
For example, if you create an OS design for the Emulator, find the Emulator folder.
  1. Expand the folder and then expand the Project Specific Files folder.
  2. Select and open the appropriate registry file.
Typically, this is the Project.reg file. Settings in Project.reg override other registry settings due to the order in which the build system processes the registry files.
  1. Update or add the HKEY_LOCAL_MACHINE/Init section of the registry file with the following code.
6.     [HKEY_LOCAL_MACHINE/Init]
7.     "launchnn"="defined_module_name"
"dependnn"=hex:xx,yy...
The following table shows descriptions of the parameters in the code you must update or add to the HKEY_LOCAL_MACHINE/Init section of the registry file.
Parameter Description
launchnn Defines the order that the module is started in, where nn is 00–99. Enclose this parameter in double quotation marks (" ").
defined_module_name Specifies the name of the module to be started. Enclose this parameter in double quotation marks (" ").
dependnn Optional. Assigns a dependency that prevents the defined module from starting until another module is started, where nn is 00–99. Enclose this parameter in double quotation marks (" ").
hex:xx,yy... Defines the hexadecimal number of the module that must be run before the defined module is run. This parameter consists of the hex keyword, a colon, and one or more hexadecimal numbers, one for each byte of hexadecimal data.
After your run-time image calls a module using the Init registry value, the application must call the SignalStarted function. SignalStarted indicates that the module is ready for the rest of the OS to continue processing. The value passed as the parameter to SignalStarted is the value passed on the command line of the module started from the Init key.
  1. If you do not know the hexadecimal numbers for the module dependencies that your application requires, open and search Common.reg for the module names.
The following code example shows how to set your module to depend on the standard initialization modules, which include Filesys.exe, Gwes.exe, Device.exe, and Explorer.exe.
[HKEY_LOCAL_MACHINE/Init]
"launchnn"="defined_exe_name"
"dependnn"=hex:0A,00,14,00,1E,00,32,00
  1. Save and close the registry file.

You have successfully modified a registry file to run a module at startup. 

以上方法是要通赤修改註冊表來實現,對於使用者來說,可能不方便,那麼,我們能不能使Windows CE啟動完成後自動運行Flash Disk上某個目錄下的所的.exe檔案呢,請看下面的:

在Windows CE 的Windows 目錄下,有一個StartUp檔案夾,在Windows CE啟動完成後,Windows CE會自動運行這個檔案夾下的所有.ExE檔案,但這個目錄下的所有內容在斷電後會丟失,還是不能完成上電自動運行,那麼我們能不能把這個目錄改到Flash Disk上的某個目錄下去呢,答案是肯定的,而且非常容易,我們只要修改註冊表

[HKEY_LOCAL_MACHINE/SYSTEM/Explorer/Shell Folders]

"StartUp"="Flash Disk//StartUp"

這樣,Windows CE開機後就會運行Flash Disk/StartUp目錄下的所有.ExE檔案.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.