扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:维维编译 来源:天极开发 2007年11月21日
关键字:
Imports System.Windows.Forms Imports System.Diagnostics Imports System.Reflection Imports System.IO Imports Microsoft.Win32 <System.ComponentModel.RunInstaller(True)> _ Public Class SetupApp Inherits System.Configuration.Install.Installer Private Const INI_FILE As String = "\setup.ini" Private Sub Installer_AfterInstall(ByVal sender As Object, _ ByVal e As System.Configuration.Install.InstallEventArgs) _ Handles MyBase.AfterInstall '---to be executed when the application is installed--- Dim ceAppPath As String = GetWindowsCeApplicationManager() If ceAppPath = String.Empty Then Return End If Dim iniPath As String = GetIniPath() Process.Start(ceAppPath, iniPath) End Sub Private Sub Installer_AfterUninstall(ByVal sender As Object, _ ByVal e As System.Configuration.Install.InstallEventArgs) _ Handles MyBase.AfterUninstall '---to be executed when the application is uninstalled--- Dim ceAppPath As String = GetWindowsCeApplicationManager() If ceAppPath = String.Empty Then Return End If Dim iniPath As String = GetIniPath() Process.Start(ceAppPath, String.Empty) End Sub Public Shared Function GetWindowsCeApplicationManager() As String '---check if the Windows CE Application Manager is installed--- Dim ceAppPath As String = KeyExists() If ceAppPath = String.Empty Then MessageBox.Show("Windows CE App Manager not installed", _ "Setup", MessageBoxButtons.OK, _ MessageBoxIcon.Error) Return String.Empty Else Return ceAppPath End If End Function Public Shared Function GetIniPath() As String '---get the path of the .ini file--- Return """" & _ Path.Combine(Path.GetDirectoryName( _ System.Reflection.Assembly. _ GetExecutingAssembly().Location), "Setup.ini") & """" End Function Private Shared Function KeyExists() As String '---get the path to the Windows CE App Manager from the registry--- Dim key As RegistryKey = _ Registry.LocalMachine.OpenSubKey( _ "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\CEAPPMGR.EXE") If key Is Nothing Then Return String.Empty Else Return key.GetValue(String.Empty, String.Empty) End If End Function End Class |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者