WEB开发网
开发学院软件开发VC 开发和部署 Pocket PC 安装程序 阅读

开发和部署 Pocket PC 安装程序

 2007-03-17 21:27:06 来源:WEB开发网   
核心提示: Cab向导(cabwiz.exe)生成.cab文件,该文件可以被安装在不同的Pocket PC设备上,开发和部署 Pocket PC 安装程序(5),一个.inf文件作为命令行的第一个参数传递,用于向向导描述应用程序,其它可选参数为目的路径,你可以访问You can visit Micro

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,
  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.");
  }
}   
VB.NetPrivate Sub Installer_AfterInstall(ByVal sender As Object, _
  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
Setup.ini文件

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:开发 部署 Pocket

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接