zoukankan      html  css  js  c++  java
  • 在vbscritp 中调用 C#生成的dll 组件

    环境:vs2005,window XP 

    第一步:
      添加一个类库组件,添加cs文件,代码如下:
       using System;
       using System.Collections.Generic;
       using System.Text;

       namespace AspDll
       {
           public class firstDll
           {
               public firstDll()
               { }
               public int Contulation(int a,int b)
               {
                      return a + b; 
               }
               public string returnHello(string name)
               {
                   return "Hello" + name;
               }
           }
       }

    第二步:
       打开类文件所在项目属性页,选择"生成"标签,把"为COM Interop 注册"勾上.
    第三步:
        把AssemblyInfo.cs文件中的[assembly: ComVisible(false)] 改为[assembly: ComVisible(true)]

    第四步:编译生成.dll
    第五步:在Asp调用:
       set clsa=server.CreateObject("AspDll.firstDll")
            three=clsa.returnHello("china")
        response.Write("<script>alert('"&three&"')</script>")

    <完>

  • 相关阅读:
    PLINQ 简介
    windows phone 网易云阅读hubtile效果实现
    windows phone 生产含logo的二维码
    windows phone 生产二维码和解码本地二维码图片
    element loading源码
    element input-number源码
    element Image组件
    element form源码
    element dropdown源码
    element Divider源码
  • 原文地址:https://www.cnblogs.com/subingster/p/839144.html
Copyright © 2011-2022 走看看