开发和部署 Pocket PC 安装程序
2007-03-17 21:27:06 来源:WEB开发网Cab向导(cabwiz.exe)生成.cab文件,该文件可以被安装在不同的Pocket PC设备上。一个.inf文件作为命令行的第一个参数传递,用于向向导描述应用程序。其它可选参数为目的路径,错误日志文件,和CPU类型。你可以访问You can visit Microsoft Windows CE .NET: CAB Wizard Syntax获取更多的信息。
安装程序组件
自定义安装组件通过处理AfterInstall和AferUnInstall事件以及运行WinCE应用程序管理器实现部署过程自动化。WinCE应用程序管理器的路径存储在注册表HKLMsoftwareMicrosoftWindowsCurrentVersionApp PathsCEAppMgr.exe 健值下。下面是 AfterInstall和AferUnInstall 事件的代码:
C#private void Installer_AfterInstall(object sender,
VB.Net
System.Configuration.Install.InstallEventArgs e)
{
// get fullpath to .ini file
string arg = Path.Combine(
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
"Setup.ini");
// run WinCE App Manager to install .cab file on device
RunAppManager(arg);
}
private void Installer_AfterUninstall(object sender,
System.Configuration.Install.InstallEventArgs e)
{
// run app manager in uninstall mode (without any arguments)
RunAppManager(null);
}
private void RunAppManager(string arg)
{
// get path to the app manager
const string RegPath = @"SoftwareMicrosoftWindows" +
@"CurrentVersionApp PathsCEAppMgr.exe";
RegistryKey key = Registry.LocalMachine.OpenSubKey(RegPath);
string appManager = key.GetValue("") as string;
if (appManager != null)
{
// launch the app
Process.Start(
string.Format(""{0}"", appManager),
(arg == null) ? "" : string.Format(""{0}"", arg));
}
else
{
// could not locate app manager
MessageBox.Show("Could not launch the WinCE Application Manager.");
}
} Private Sub Installer_AfterInstall(ByVal sender As Object, _
Setup.ini文件
ByVal e As System.Configuration.Install.InstallEventArgs) _
Handles MyBase.AfterInstall
'''' get fullpath to .ini file
Dim arg As String = Path.Combine(Path.GetDirectoryName( _
System.Reflection.Assembly.GetExecutingAssembly().Location), _
"Setup.ini")
'''' run WinCE App Manager to install .cab file on device
RunAppManager(arg)
End Sub
Private Sub Installer_AfterUninstall(ByVal sender As Object, _
ByVal e As System.Configuration.Install.InstallEventArgs) _
Handles MyBase.AfterUninstall
'''' run app manager in uninstall mode (without any arguments)
RunAppManager(Nothing)
End Sub
Private Sub RunAppManager(ByVal arg As String)
'''' get path to the app manager
Const RegPath As String = "SoftwareMicrosoftWindows" & _
"CurrentVersionApp PathsCEAppMgr.exe"
Dim key As RegistryKey = Registry.LocalMachine.OpenSubKey(RegPath)
Dim appManager As String = CStr(key.GetValue(""))
If Not (appManager Is Nothing) Then
If arg Is Nothing Then
Process.Start(String.Format("""{0}""", appManager))
Else
'''' launch the app
Process.Start( _
String.Format("""{0}""", appManager), _
String.Format("""{0}""", arg))
End If
Else
'''' could not locate app manager
MessageBox.Show("Could not find app manager")
End If
End Sub
- ››开发Android 日历教程
- ››开发学院总结 Win 8实用技巧大全
- ››开发学院原创教程:把win8的IE10放桌面上方法(非...
- ››部署RTX2011服务器应注意的问题
- ››开发者眼中的Windows Phone和Android
- ››开发学院教你用SQL 语句最快速清空MySQL 数据表的...
- ››部署SQL AZURE的客户端管理工具,云计算体验之二
- ››部署DHCP常犯的错误
- ››部署额外域控制器,Active Directory系列之四
- ››部署第一个域:Active Directory系列之二
- ››Pocket Player睡眠定时器不能选择问题的解决办法
- ››开发一个自己的HTML在线编辑器(一)
更多精彩
赞助商链接