web显示winform,web打开winform,IE打开winform
时间:2014-06-25 08:15:52
收藏:0
阅读:296
前言:为什么要用ie打开winform
个人认为,winform部署客户端太麻烦如金蝶··用友,winfrom打补丁太麻烦,添加新功能再部署非常费时间;于是就想为什么不能用IE打开呢?这样就不需要部署客户端,文件更新只需要在服务器做。有想法就一定要实现。。
好处,winform稳定,前台控件devpress完全满足UI,不需要写大量的WEB前台美化代码,更重要的开发非常省时间。。。。。。
----------------------------------------------------------------
开发环境: win7+vs2010
web服务器:win2008 自带web服务程序
----------------------------------------------------
<table id=‘waiting‘ style=‘width:100%; height:100%;position:absolute; visibility:hidden; background:#ffffff;‘ border=‘0‘ cellspaceing=‘0‘ cellpadding=‘0‘>
<tr>
<td valign=‘middle‘ align=‘center‘>
<table border=‘2‘ cellspacing=‘2‘ height=‘50‘>
<tr>
<td align=‘center‘ width=‘400‘ style=‘font-size:12pt; background:#ffffff;‘>
<b><font color=‘blue‘>Loading...</font></b>
</td>
</tr>
</table>
</td>
</tr>
</table>
<script language=‘Javascript‘> waiting.style.visibility=‘visible‘ </script>
<html>
<head>
<link rel="shortcut icon" href="swerp.ico">
<title>⑵⑵ SuHe SYSTEM ⑵⑵</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<style type="text/css">
/*
body {
scrollbar-shadow-color: #ffffff;
scrollbar-highlight-color: #ffffff;
scrollbar-face-color: #d9d9d9;
scrollbar-3dlight-color: #d9d9d9;
scrollbar-darkshadow-color: #d9d9d9;
scrollbar-track-color: #ffffff;
scrollbar-arrow-color: #ffffff;
}
*/
html, body { overflow:hidden; }
</style>
<script language="text/javascript">
function window.onload()
{
try
{
if (document.all.waiting != null)
{
document.all.waiting.style.visibility = "hidden";
document.all.waiting.style.height = "0px";
}
}
catch(e)
{
alert(e.name + "[Load] : " + e.message);
if (document.all.waiting.style.height != "0px")
{
document.all.waiting.style.visibility = "hidden";
document.all.waiting.style.height = "0px";
}
}
}
</script>
</head>
<body leftmargin="3" topmargin="3" marginwidth="3" marginheight="3" overflow:hidden; >
<object classid="MainControlLibrary.dll#MainControlLibrary.MainControlLibrary" height="100%" width="100%"/>
</body>
</html>
----------------------------------------------------
1. 以上是网页代码(main.htm),解析 dll文件 ,注意最后一句话 ,切记别语法格式
MainControlLibrary.dll#MainControlLibrary.MainControlLibrary
----------------------------------------------------
2. MainControlLibrary.dll 如何生成
vs-C#-WindowsFormsControlLibrary3-UserControl1.cs (页面内容自己添加)
将 WindowsFormsControlLibrary3 改为 MainControlLibrary
UserControl1 改为 MainControlLibrary
-----------------------------------------------------
3.web服务器设置
配置不做讲解。
网站-Default web site --添加应用程序-别名(webdll)--物理路径(web网页和dll文件路径)--确定
------------------------------------------------------
4. 客户端IE 设置
收信任的站点 --ip地址添加--自定义级别--全部启用 Activex
win7 .net安全设置 cmd 运行 或者保存批处理运行,注意要管理员权限
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\caspol.exe -q -rg "1"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\caspol -pp off -machine -addgroup All_Code -url http://192.168.20.20/* FullTrust -n 1
--------------------------------------------------------
5. ie中输入 http://192.168.20.20/webdll/main.htm
可以和winform一样操作数据
-------完成-------------
------------------------------------------------------
后续探讨问题:
1.数据传输也用web服务器实现(sql连接文件放在服务器上)2.动态添加菜单
3.动态添加dll
评论(0)