C # encapsulates an existing program as a DLL file for other programs to call

Source: Internet
Author: User

C # encapsulates an existing program as a DLL file for other programs to call

If the development of the program is very large, the function is very complex, the load is very slow, the user feel bad, so you can separate some features, packaged as a DLL file, when the program runs when necessary to call, speed up the program response.

Search on the Internet, in fact, the process is relatively simple:

Open a line under the project---solution---properties---application---Modify the output type to class library, F5 compile the program.

At this point, you will be prompted with the following error:

---------------------------
Microsoft Visual Studio
---------------------------
The project with the class library output type cannot be started directly.

To debug this project, add an executable project that references the library project in this solution. Set the executable project as the startup Project.
---------------------------
Are you sure
---------------------------

This error message does not need to be checked, now in the folder where the program is viewed, DLL files have been generated.

After testing, the above method generates DLL files that other programs can call and open normally.

Call Procedure:

(assuming that the generated DLL file is "Aaa.dll" and AAA is the namespace name)

1, the new procedure;

2. Add Reference: Add the Aaa.dll file to the reference;

3, add header file: Using AAA;

4. Call: Add the following code where needed:

Aaa. Form1 MyForm2 = new AAA. Form1 ();
Myform2.show ();

C # encapsulates an existing program as a DLL file for other programs to call

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.