How to call standard DLL functions in C #

zhaozj2021-02-08  304

Pinvoke (Platform Invocation) is only required in C #. C # supports a Sysimport property supports this call. The following is a complete syntax form (not all parameters used in the example): [Sysimport (DLL = DLLNAME, NAME = FunctionName, Charset = CharactersettOBeuses) gives an example of calling the Win32 MessageBox function: use system; class pinvokeclient { [sysimport (dll = "user32.dll")] public static extern int MessageBoxA (int hwnd, string message, string caption, int type); public static void Main () {int result = MessageBoxA (0, "Hello World", "Pinvoke Test", 0);}}

转载请注明原文地址:https://www.9cbs.com/read-1482.html

New Post(0)