[地图SkyLine二次开发]关于IE内存限制问题(1G)......(续)
二次开发Skyline时(B/S),经常会遇到,IE浏览器内存不够,导致崩溃的问题。
在上一个博文中写到,将IE-32bit浏览器内存限制扩展的解决办法。
上一个博文中做出来的iexplore.exe的基础上,将Skyline的安装包,以及适应浏览器版本的程序,打包成一个安装包。
在客户第一次登陆本系统时,让客户只需安装一次就OK。
一.准备工作:
1.下载.NetFrameWork4.5
2.将IE各个版本,按上一个博文中的方法,对应每一个版本,都做出来iexplore.exe
3.做适应IE版本的程序
1).创建一个winform程序起名IE_Ver
2).在相同的解决方案下,再创建一个winform程序起名IE_Start
-两个程序创建结果如下图
3).IE_Ver程序中的代码
-该程序负责从注册表中,取出IE版本,将版本信息添加到xml文件中
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
namespace IE_Ver
{
public partial class Form1 : Form
{
string IEVersion;
string ie;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Hide();
this.ShowInTaskbar = false;
Judge();
Application.Exit();
}
/// <summary>
/// 判断IE版本,并且将结果放入IEVervsion.xml中。。。
/// </summary>
public void Judge()
{
//获取IE版本
RegistryKey mreg;
mreg = Registry.LocalMachine;
mreg = mreg.CreateSubKey("software\\Microsoft\\Internet Explorer");
IEVersion = "当前IE浏览器的版本信息:" + (String)mreg.GetValue("Version");
string[] ArrIEVersion = IEVersion.Split('.');
string[] IeV = ArrIEVersion[0].Split(':');
ie = IeV[1]; //ie=IE版本
mreg.Close();
//创建XML对象
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "yes");
XmlNode rootNode = xmlDoc.CreateElement("ServerIni");
XmlNode rootIEVersion = xmlDoc.CreateElement("IEVersion");
XmlNode rootServerIP = xmlDoc.CreateElement("ServerIP");
rootServerIP.InnerText = "http://www.baidu.com"; //打开IE时默认的服务器IP
XmlNode verNode = xmlDoc.CreateElement("VersionNo");
verNode.InnerText = ie;
rootIEVersion.AppendChild(verNode);
rootNode.AppendChild(rootIEVersion);
rootNode.AppendChild(rootServerIP);
xmlDoc.AppendChild(rootNode);
xmlDoc.Save(@"IEVersion.xml"); //保存为XML文件
}
}
}
-程序编译后,查看运行结果
4).IE_Start中的代码
-该程序负责从IE_Ver中生成出来的xml中读取版本信息,将对应的iexplore.exe打开
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml;
namespace IE_Start
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Hide();
this.ShowInTaskbar = false;
showIE();
Application.Exit();
}
private void showIE() {
XmlTextReader reader = new XmlTextReader(Application.StartupPath + "\\" + "IEVersion.xml");
string version_no = "";
string server_IP = "";
while (reader.Read())//逐个读取
{
if (reader.NodeType == XmlNodeType.Element && reader.LocalName == "VersionNo")//判断为元素节点并且节点名为name
{
version_no = reader.ReadString();//读出值
}
else if (reader.NodeType == XmlNodeType.Element && reader.LocalName == "ServerIP")
{
server_IP = reader.ReadString();
}
}
try
{ //尝试启动默认浏览器
System.Diagnostics.Process.Start(Application.StartupPath + "\\IE" + version_no + "\\iexplore.exe", server_IP);
}
catch
{ //如果启动不成功,启动IE
}
while (reader.Read())
{
Console.WriteLine(reader.Name);
}
}
}
}
-编译后,将准备好的各个IE版本对应的iexplore.exe文件拷入Debug文件夹中测试
注:该程序运行需要IE版本对应的iexplore.exe和IEVersion.xml文件
-运行IE_Start.exe结果,在已经被扩展的IE中,打开了http://www.baidu.com
-这里可以将生成出来的.exe文件图标更换一下,方法是点击项目右键->属性,修改红框中的文件
4.将上面做好的程序(IE_Ver.exe , IE_Start.exe),Skyline安装包 ,IE各个版本对应的iexplore.exe文件拷到一个文件夹中,准备打包
二.开始打包
1.下载Setup Factory 7.0并安装
2.创建新工程
3.添加文件
-找到【准备工作】中,准备好的文件目录
-添加完成
4.判断.NetFramework4.5有没有安装,如果没安装进行安装
-点击资源里的【原始文件】
-点击【添加】
-将.NetFramework4.5安装包指定
-点击【确定】,添加成功
-点击操作里的【启动时】
-将下面一段代码拷入On Startup
result = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\.NETFramework\\policy\\v4.0");
if (result == false) then
result = File.Run(SessionVar.Expand("%TempLaunchFolder%\\Microsoft.NET.exe"), "", "", SW_SHOWNORMAL, true);
end
-点击确定,添加成功
5.将做好的程序打包
-点击【安装之后】
-点击【编辑】
-【操作】tab->【On Next】->【添加操作】
-File->Run
-点击下一步,在红框中选择IE_Ver.exe
-点击完成,同样的方法将Skyline的 setup.exe添加....
-添加后的结果
-点击【确定】,添加完成
6.桌面快捷方式的选择
-点击IE_Start.exe右键-文件属性
-快捷方式中的,桌面&开始菜单>应用程序文件夹(A)打钩,然后将快捷方式的名字填写
-点击确定
7.打包
-点击【构建】
-点击【构建】
-打包完成
8.安装成功后桌面将多出来一个快捷方式,如下图
-该程序为,我们通过判断客户端IE版本打包出来的一个,扩展了内存的IE快捷方式
-现在用户可以直接点击【三维地理信息系统】快捷方式,进入我们的系统啦


浙公网安备 33010602011771号