请问在c#编程中如何使用delphi7的dll?

解决方案 »

  1.   

    请问在c#编程中如何使用delphi7写的dll?
      

  2.   

    using System.Runtime.InteropServices;
    [DllImport("pcsCardDll.dll")]
    public static extern int ReadAuthorCard(ref TParaBuf buf);
      

  3.   

    先在命令行把DLL文件转化为托管状态下的库,然后引用即可
      

  4.   

    先在命令行把DLL文件转化为托管状态下的库,然后引用即可bu ming baineng shuo ming bai yi xie ma?
      

  5.   

    using System.Runtime.InteropServices;
    [DllImport("pcsCardDll.dll")]
    public static extern int ReadAuthorCard(ref TParaBuf buf);--------------------------------------------------------------
    qing wen shang mian dai ma xie zai na li?
      

  6.   

    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;
    using System.Runtime.InteropServices;
    namespace cs_finishi
    {
    /// <summary>
    /// Summary description for Form1.
    /// </summary>
    ///
    public class RefDll
    {
    [DllImport(@"E:\StrSjisToJis.dll", EntryPoint="StrSjisTo",CharSet=CharSet.Ansi,
     CallingConvention=CallingConvention.StdCall)]
    public static extern string StrSjisTo(string str);

    } public class Form1 : System.Windows.Forms.Form {

    private System.Windows.Forms.TextBox textBox1;
    private System.Windows.Forms.Button button1;
    private System.Windows.Forms.TextBox textBox2;
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.Container components = null; public Form1()
    {
    //
    // Required for Windows Form Designer support
    //
    InitializeComponent(); //
    // TODO: Add any constructor code after InitializeComponent call
    //
    } /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows Form Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
    this.textBox1 = new System.Windows.Forms.TextBox();
    this.button1 = new System.Windows.Forms.Button();
    this.textBox2 = new System.Windows.Forms.TextBox();
    this.SuspendLayout();
    // 
    // textBox1
    // 
    this.textBox1.Location = new System.Drawing.Point(56, 40);
    this.textBox1.Name = "textBox1";
    this.textBox1.Size = new System.Drawing.Size(192, 19);
    this.textBox1.TabIndex = 0;
    this.textBox1.Text = "";
    // 
    // button1
    // 
    this.button1.Location = new System.Drawing.Point(208, 104);
    this.button1.Name = "button1";
    this.button1.TabIndex = 1;
    this.button1.Text = "button1";
    this.button1.Click += new System.EventHandler(this.button1_Click);
    // 
    // textBox2
    // 
    this.textBox2.Location = new System.Drawing.Point(64, 176);
    this.textBox2.Name = "textBox2";
    this.textBox2.Size = new System.Drawing.Size(192, 19);
    this.textBox2.TabIndex = 2;
    this.textBox2.Text = "";
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(5, 12);
    this.ClientSize = new System.Drawing.Size(432, 317);
    this.Controls.Add(this.textBox2);
    this.Controls.Add(this.button1);
    this.Controls.Add(this.textBox1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    }
    private void button1_Click(object sender, System.EventArgs e)
    {
                textBox2.Text=RefDll.StrSjisTo(textBox1.Text);
    }
    }
    }
      

  7.   

    zhe shi wo de yuan madiao yong zong shi chu cuo!da jia kan kan xie xie!
      

  8.   

    bao cuo ru xia:An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication1.exeAdditional information: Object reference not set to an instance of an object.
      

  9.   

    是否应该和WIN32的引用相同呢,没有试过,标记一下