关于“asp.net(C#)调用C++程序并交互操作 ”的问题,请推荐相关的书籍(最好带有PDF或word版下载地址)以及相关的网页链接或文章链接等。    非常感谢!

解决方案 »

  1.   

    http://edu.codepub.com/2010/0607/23334.php
      

  2.   

    这个太简单了,试验过了,在屏幕上闪过一下doc窗口 ,有没有更深入的介绍?
      

  3.   

    有一种说法是首先编写响应程序的动态链接库,然后再c++程序和.net之间架设一个中间层webservice用作通信 这样就可以了,谁有相关方面的资料?
      

  4.   

    我学的时候没有找到,都是从MSDN上学的。
      

  5.   

    你是从MSDN上学到的吗? 学的.Net调用c++COM? 我这里现有的C++程序使用vc MFC写的,能简单说说吗?
      

  6.   

    考虑到将来有可能需要用C#调用C++的程序,先实验一下。
    先准备下C++程序:
    考虑到将来有可能需要用C#调用C++的程序,先实验一下。
    先准备下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();
        }

    本篇文章来源于:开发学院 http://edu.codepub.com   原文链接:http://edu.codepub.com/2010/0607/23334.php