本人用VB.NET开发了exe程序属于C/S框架的,但目前为了满足客户的需要要改成B/S的形式显示,就是直接将程序嵌入到WEB页面让用户浏览,不知道那位大侠知道是否可行啊,以前从未尝试过,如果可行的话,用什么方式可以实现!谢谢了。

解决方案 »

  1.   

    应该是可以的,但没亲自弄过,建议楼主看些.net互操作方面的书籍,给一个小例子
    先准备下C++程序:
    #include <stdio.h>
    #include <iostream>
    int main()
    {
        printf("hi");
        int v1,v2;
        std::cin>>v1;
        v2=v1*2;
        std::cout<<v2<<std::endl;
    }
     
    用C#调用:大气象 using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;using System.Diagnostics;public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Bind();
        }
        private void Bind()
        {
            Process p = new Process();
            p.StartInfo.FileName = @"F:\code\cpp\FirstCmd\debug\FirstCmd.exe";
            //p.StartInfo.Arguments = "";
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardInput = true;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.CreateNoWindow = false;
            p.Start();
            //
            p.StandardInput.WriteLine("2");
            string output = p.StandardOutput.ReadToEnd();
            Response.Write(output);
            //if (p.HasExited)
            //    p.Kill();
        }
    }
      

  2.   

    我刚试了下,可以运行程序起来,但是没有像web的一些插件一样在web上面显示。还是很感谢楼上的!
      

  3.   

    做成activeX控件
    但客户端都要 装.net framwork
      

  4.   

    不是屏蔽掉了,就像是一个下载到本地的程序一样运行了!不是在web页面上显示程序页面![Quote=引用 5 楼 hongdi 的回复:]
    做成activeX控件
    但客户端都要 装.net framwork
    如果是这样的话那上传下载就可以实现了就没有WEB的意义,我想实现的效果和WEB一样,不需要安装什么东西,像浏览网站一样,不知道用什么方式可以实现。
     
      

  5.   

    运行是可以的,但不可能呈现在web界面上
      

  6.   

    需要在客户端安装.net framwork吗?