http://download.csdn.net/detail/shaohuatsou/5033123
是为该资源上传的源代码
之前用的打包程序都是VS自带的或者是第三方的打包程序,虽然提供了很多自定义的操作和界面,但始终想自己研究下原理,然后自己就用C#写了一个安装包。
该安装包安装之后会在开始菜单和桌面创建快捷方式,系统的添加删除程序项,系统服务项,并释放几个测试程序。
卸载的时候会一并清理干净,不会留下任何残留项。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-06-27 11:46 Installation
目录 0 2013-05-06 10:29 Installationin
目录 0 2013-07-09 21:47 InstallationinDebug
文件 1643008 2013-07-09 21:47 InstallationinDebugInstallation.exe
文件 79360 2013-07-09 21:47 InstallationinDebugInstallation.pdb
目录 0 2013-05-06 10:29 InstallationCommon
文件 9876 2013-05-06 10:29 InstallationCommonShortcut.cs
文件 26524 2013-05-06 10:36 InstallationFrmInstallation.cs
文件 29151 2013-05-06 10:29 InstallationFrmInstallation.Designer.cs
文件 5814 2013-01-27 11:17 InstallationFrmInstallation.resx
文件 5344 2013-05-06 10:29 InstallationFrmMsg.cs
文件 8510 2013-05-06 10:29 InstallationFrmMsg.Designer.cs
文件 5814 2013-01-26 14:00 InstallationFrmMsg.resx
文件 8366 2013-05-06 10:29 InstallationInstallation.csproj
文件 488 2013-01-27 14:04 InstallationInstallation.csproj.user
文件 309830 2013-01-25 11:13 InstallationInstallation.ico
目录 0 2013-06-27 11:46 Installationobj
目录 0 2013-08-03 09:52 InstallationobjDebug
文件 962 2013-07-09 21:47 InstallationobjDebugInstallation.csproj.FileListAbsolute.txt
文件 1187 2013-07-09 21:47 InstallationobjDebugInstallation.csproj.GenerateResource.Cache
文件 1643008 2013-07-09 21:47 InstallationobjDebugInstallation.exe
文件 180 2013-07-09 21:47 InstallationobjDebugInstallation.FrmInstallation.resources
文件 180 2013-07-09 21:47 InstallationobjDebugInstallation.FrmMsg.resources
文件 79360 2013-07-09 21:47 InstallationobjDebugInstallation.pdb
文件 865650 2013-07-09 21:47 InstallationobjDebugInstallation.Properties.InstallFiles.resources
文件 424057 2013-07-09 21:47 InstallationobjDebugInstallation.Properties.Resources.resources
目录 0 2013-08-03 09:52 InstallationobjDebugRefactor
目录 0 2013-06-27 11:46 InstallationobjDebugTempPE
文件 2137 2013-05-06 10:29 InstallationProgram.cs
目录 0 2013-07-09 21:47 InstallationProperties
文件 1444 2013-07-09 21:47 InstallationPropertiesAssemblyInfo.cs
............此处省略102个文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;
using System.Threading;
using Microsoft.Win32;
using System.ServiceProcess;
using System.Diagnostics;
namespace Installation
{
public partial class FrmInstallation : Form
{
///
/// 可填充区域,用户可根据实际安装需求更改此项
///
public string strCompanyNameEnglish = “XYBarcode“;
public string strProductNameEnglish = “MESBarcodeServer“;
public string strServiceNameEnglish = “MES Barcode Server“;
public string strCompanyURL = “http://www.xybarcode.com“;
///
/// 程序变量,请勿更改
///
private string strInstallationPath = ““;
private bool bExpansion = false bDesktoplink = true bStartMenulink = true bStartBarlink = true bUserExperience = true;
private int iFormSizeHeightNor = 360 iFormSizeHeightExp = 470;
private string strResult = ““;
private FolderBrowserDialog fbd = new FolderBrowserDialog();
#region 拖动无边框窗体
[DllImport(“user32.dll“)]
public static extern bool ReleaseCapture();//改变窗体大小
[DllImport(“user32.dll“)]
public static extern bool SendMessage(IntPtr hwnd int wMsg int wParam int lParam);//发送windows消息
#endregion
#region 窗体边框阴影效果变量申明
const int CS_DropSHADOW = 0x20000;
const int GCL_style = (-26);
//声明Win32 API
[DllImport(“user32.dll“ CharSet = CharSet.Auto)]
public static extern int SetClassLong(IntPtr hwnd int nIndex int dwNewLong);
[DllImport(“user32.dll“ CharSet = CharSet.Auto)]
public static extern int GetClassLong(IntPtr hwnd int nIndex);
#endregion
public FrmInstallation()
{
InitializeComponent();
fbd.RootFolder = System.Environment.SpecialFolder.Desktop;
fbd.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
fbd.ShowNewFolderButton = true;
txtPath.Text = fbd.SelectedPath + “\“ + strCompanyNameEnglish + “\“ + strProductNameEnglish;
SetClassLong(this.Handle GCL_style GetClassLong(this.Handle GCL_style) | CS_DropSHADOW); //API函数加载,实现窗体边框阴影效果
lblMaintitle.Text = Application.ProductName;
this.Text = Application.ProductName + “安装程序“;
this.Icon = Installation.Properties.Resources.Installation;
lblCompanyName.Text = Application.CompanyName;
}
private void FrmMain_Load(object sender EventArgs e)
{
ThreadPool.QueueUserWorkItem(new WaitCallback(ShowMain) null);
}
private void ShowMain(object obj)
{
while (this.Opacity!=1)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-06-27 11:46 Installation
目录 0 2013-05-06 10:29 Installationin
目录 0 2013-07-09 21:47 InstallationinDebug
文件 1643008 2013-07-09 21:47 InstallationinDebugInstallation.exe
文件 79360 2013-07-09 21:47 InstallationinDebugInstallation.pdb
目录 0 2013-05-06 10:29 InstallationCommon
文件 9876 2013-05-06 10:29 InstallationCommonShortcut.cs
文件 26524 2013-05-06 10:36 InstallationFrmInstallation.cs
文件 29151 2013-05-06 10:29 InstallationFrmInstallation.Designer.cs
文件 5814 2013-01-27 11:17 InstallationFrmInstallation.resx
文件 5344 2013-05-06 10:29 InstallationFrmMsg.cs
文件 8510 2013-05-06 10:29 InstallationFrmMsg.Designer.cs
文件 5814 2013-01-26 14:00 InstallationFrmMsg.resx
文件 8366 2013-05-06 10:29 InstallationInstallation.csproj
文件 488 2013-01-27 14:04 InstallationInstallation.csproj.user
文件 309830 2013-01-25 11:13 InstallationInstallation.ico
目录 0 2013-06-27 11:46 Installationobj
目录 0 2013-08-03 09:52 InstallationobjDebug
文件 962 2013-07-09 21:47 InstallationobjDebugInstallation.csproj.FileListAbsolute.txt
文件 1187 2013-07-09 21:47 InstallationobjDebugInstallation.csproj.GenerateResource.Cache
文件 1643008 2013-07-09 21:47 InstallationobjDebugInstallation.exe
文件 180 2013-07-09 21:47 InstallationobjDebugInstallation.FrmInstallation.resources
文件 180 2013-07-09 21:47 InstallationobjDebugInstallation.FrmMsg.resources
文件 79360 2013-07-09 21:47 InstallationobjDebugInstallation.pdb
文件 865650 2013-07-09 21:47 InstallationobjDebugInstallation.Properties.InstallFiles.resources
文件 424057 2013-07-09 21:47 InstallationobjDebugInstallation.Properties.Resources.resources
目录 0 2013-08-03 09:52 InstallationobjDebugRefactor
目录 0 2013-06-27 11:46 InstallationobjDebugTempPE
文件 2137 2013-05-06 10:29 InstallationProgram.cs
目录 0 2013-07-09 21:47 InstallationProperties
文件 1444 2013-07-09 21:47 InstallationPropertiesAssemblyInfo.cs
............此处省略102个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)