C # to call C # DLL

Add a reference load dll-

  add a reference to the path means arranged to load the program so that when the corresponding dll generated. The steps are referenced as follows:
  Solution -> References -> Add Reference -> Browse -> select the path where dll -> determined
herein described write image
import the namespace, instantiate the object, call the function

  only of introducing the dll namespace, you can use the class in this space. Therefore, after the first step is to import the dll referenced namespace; the second step is to instantiate the class object; and finally to call its member function uses class object. Calling the code shown below in packaged DMC3000.dll initialization function.

the System the using;
the using the System.Collections.Generic;
the using the System.ComponentModel;
the using the System.Data;
the using the System.Drawing;
the using the System.Linq;
the using the System.Text;
the using System.Threading.Tasks;
the using the System.Windows.Forms;
the using nsLTDMC;

// (. 1) introduced into the namespace
the using nsDMC3000;


namespace DalsaConfig
{
    public partial class the Form1: Form1
    {
        // (2) declared class object
        M_f1DMC3000 DMC3000;
        public the Form1 ()
        {
            // (. 3) of the instance of the class object
            m_f1DMC3000 DMC3000 new new = ();
            the InitializeComponent ();

            // (. 4) in the calling function dll
            BOOL bIniResult m_f1DMC3000.Init = ();
            IF (to true bIniResult ==)
            {
                MessageBox.Show ( "the Init the OK");
            }
            the else
            {
                MessageBox.Show () "the Init the Failed!";
            }
        }
    }
}
----------------
Rights Disclaimer: this article is the original article CSDN bloggers "LUO Ze" and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/u013698770/article/details/53471022

Guess you like

Origin www.cnblogs.com/YZFHKMS-X/p/11826488.html