C # detailed description of calling dephi dll

Source: Internet
Author: User

C # Use DllImport to call dephi dll
Generally, it is not hosted.
The specific format is as follows: [DllImport ("WZFSE. dll", CharSet = CharSet. Ansi, CallingConvention = CallingConvention. StdCall)]
The following is his declarative function.
Public static extern void InitDll (IntPtr handle, bool methodAddress );
Declare a function to reference its dll
IntPtr can be declared as a handle or pointer in other languages.
To implement a function pointer similar to C ++ in other languages, we should use the C # Delegate to implement

It is also important to check the dephi form into your C # system. We call the dephi form. The dephi form is displayed in the C # form.

In this case, what should we do? How can we remove the form in dephi? Now we need to use the API function, and the API function is also available in dephi C #.
In C #, [DllImport ("user32.dll", CharSet = CharSet. Ansi, CallingConvention = CallingConvention. StdCall)]
Public static extern void MoveWindow (IntPtr handler, int x, int y, int width, int height, bool repaint );

Insert a class below. Here, the package contains how to reference dephi dll and how to declare it.

Code 1 public class CompliancePlatDLL
2 {
3 public static string strPath = "";
4 /// <summary>
5 // Initialization
6 /// </summary>
7 // <param name = "handle"> </param>
8 /// <param name = "methodAddress"> </param>
9 [DllImport ("WZFSE. dll", CharSet = CharSet. Ansi, CallingConvention = CallingConvention. StdCall)]
10 public static extern void InitDll (IntPtr handle, bool methodAddress );
11 /// <summary>
12 // load the corresponding service
13 /// </summary>
14 /// <param name = "str"> </param>
15 /// <param name = "str2"> </param>
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.