Windows mobile application learning
Here are summaries of how to package applications and updates
please refer to the help documents in the SDK for details.
1. you must create an information file (.inf).
the information file will complete the operations of copying files and setting register keys.It can be created by any text editors.
The CAB Wizard will use the .inf file to construct a file called _install.xml, which will give instructions on how the application should be installed.
please note that the register keys and its value and destination file names should be converted into ANSI characters.
The following table shows the sections that can make up an .inf file.
Appears in the DefaultInstall section.
The following code sample shows an information (.inf) file that can be used as a template for the common operations that are required for installing an application that is not targeted at specific hardware platforms.
[Version] Signature = "$Windows NT$" ; required as-is Provider = "Microsoft" ; maximum of 30 characters, full app name will be "<Provider> <AppName>" CESignature = "$Windows CE$" ; required as-is [CEStrings] AppName = "Mine Sweeper" ; maximum of 40 characters, full app name will be "<Provider> <AppName>" InstallDir = %CE1%\%AppName% ; Program Files\Mine Sweeper [SourceDisksNames] ; directory that holds the application's files 1 = , "Common Files",,Common [SourceDisksFiles] ; list of files to be included in .cab bigexpl.wav = 1 miniwin.wav = 1 winmine.exe = 1 [DefaultInstall] ; operations to be completed during install CopyFiles = CopyToProgramFiles AddReg = RegData CEShortcuts = Shortcuts [DestinationDirs] ; default destination directories for each operation section CopyToProgramFiles = 0, %InstallDir% Shortcuts = 0, %CE14% ; \Windows\Start Menu\Programs\Games [CopyToProgramFiles] ; copy operation file list "winmine.exe", winmine.exe "miniwin.wav", miniwin.wav "bigexpl.wav", bigexpl.wav [RegData] ; registry key list HKCU,Software\%AppName%,MajorVersion,0x00010001,1 HKCU,Software\%AppName%,MinorVersion,0x00010001,0 [Shortcuts] ; Shortcut created in destination dir, %CE14% %AppName%,0,winmine.exe
The .inf file you create must point to the location of the finalized program files you want to package. The Provider Name and Application Name cannot contain XML reserved characters and Windows CE file system reserved characters, such as: \/:*?" < >|&.
You can use information (.inf) files in tandem with the CAB Wizard to create multiple cabinet (.cab) files targeted for specific hardware platforms.
The following example shows the CAB Wizard syntax that is used to create two .cab files, targeted for different hardware platforms, at the same time when used with the following .inf file.
cabwiz ComplexINF.inf /cpu x86Emul ARMDevice /platform PPC
The .inf file in the following example shows how to use the [CEDevice] and [Platform] sections in an .inf file to target specific hardware platforms. The application in this example, MyApplication, can be installed on both x86 and ARM-based hardware platforms.
[Version] Signature = "$Windows NT$" ; required as-is Provider = "MyCompany" ; maximum of 30 characters, full app name will be "<Provider> <AppName>" CESignature = "$Windows CE$" ; required as-is [CEStrings] AppName = "MyApplication" ; maximum of 40 characters, full app name will be "<Provider> <AppName>" InstallDir = %CE1%\%AppName% ; Program Files\MyApplication [Strings] ; Custom substitution strings that can be used later in the INF file AppRegKeyName = "Software\MyCompany\MyApplication" ; The following (optional) section identifies a target Pocket PC platform. ; To generate cab for this platform, use "/platform PPC" command line parameter with the CAB Wizard [Platform.PPC] PlatformString = PocketPC PlatformMin = 3.0 PlatformMax = 4.0 [CEDevice.x86Emul] ProcessorType = 686 UnsupportedPlatforms="HPC", "Jupiter", "Palm PC" [CEDevice.ARMDevice] ProcessorType = 2577 UnsupportedPlatforms="HPC", "Jupiter", "Palm PC" [SourceDisksNames] ; directory that holds the application's files that are common for different platforms 1 = , "Common Files",,..\Common ; relative path from the INF file's location [SourceDisksNames.x86Emul] ; directory that holds the application's files that are specific to the x86Emul based platform 2 = ,"x86Emul Files",,..\x86 ; relative path from the INF file's location [SourceDisksNames.ARMDevice] ; directory that holds the application's files that are specific to the ARMDevice based platform 2 = ,"ARMDevice Files",,..\ARM ; relative path from the INF file's location [SourceDisksFiles] ; list of common files to be included in .cab bigexpl.wav = 1 miniwin.wav = 1 [SourceDisksFiles.x86Emul] ; list of x86Emul specific files to be included in .cab winmine.exe = 2 ComServer1.dll = 2 ComServer2.dll = 2 Setup.dll = 2 [SourceDisksFiles.ARMDevice] ; list of ARMDevice specific files to be included in .cab winmine.exe = 2 ComServer1.dll = 2 ComServer2.dll = 2 Setup.dll = 2 [DefaultInstall] ; operations to be completed during install CopyFiles = CopyToProgramFiles, CopyToWindows AddReg = RegData CEShortcuts = Shortcuts CESelfRegister = ComServer1.dll, ComServer2.dll CESetupDLL = Setup.dll [DestinationDirs] ; default destination directories for each operation section CopyToProgramFiles = 0, %InstallDir% CopyToWindows = 0, %CE2% ; \Windows Shortcuts = 0, %CE14% ; \Windows\Start Menu\Programs\Games [CopyToProgramFiles] ; copy operation file list "winmine.exe", winmine.exe "miniwin.wav", miniwin.wav "bigexpl.wav", bigexpl.wav [CopyToWindows] "Server1.dll", ComServer1.dll ; the file will be named "Server1.dll" on the device "Server2.dll", ComServer2.dll [RegData] ; registry key list HKCU,%AppRegKeyName%,MajorVersion,0x00010001,1 HKCU,%AppRegKeyName%,MinorVersion,0x00010001,0 [Shortcuts] %AppName%,0,winmine.exe ; Shortcut created in destination dir %CE14% as specified in [DestinationDirs] section for Shortcuts %AppName%,0,winmine.exe, %CE17% ; Shortcut created in %CE17% ()
The .inf file you create must point to the location of the finalized program files you want to package in the .cab file. The Provider Name and Application Name cannot contain XML reserved characters and Windows CE file system reserved characters, such as: \/:*?" < >|&.
posted on 2008-11-19 19:25 叶玉 阅读(105) 评论(0) 编辑 收藏 网摘
Powered by: 博客园 Copyright © 叶玉