[DllImport( "KERNEL32。 DLL”,
EntryPoint="MoveFileW ",
SetLastError=true,
CharSet = character set. Unicode,
ExactSpelling=true,
Call convention = call convention. StdCall
)
]
public static extern bool MoveFile(String src,String dst);
Parameter description:
EntryPoint specifies the DLL entry point to call.
SetLastError determines whether there is an error when executing this method (use the Marshal function. GetLastWin32Error API to determine)
The default value in C# is false.
CharSet controls the encoding of string parameters in names and functions. The default value is CharSet. american national standards institute
Whether ExactSpelling modifies the entry point to correspond to different character encoding methods.
CallingConvention specifies the calling convention used to pass method parameters. The default value is WinAPI.
This value corresponds to __stdcall based on 32-bit Intel platforms.
Whether BestFitMapping enables the best mapping function defaults to true.
The best mapping function automatically provides matching characters when there is no match.
Characters that cannot be mapped are usually converted to the default "?" .
Whether the signature of the PreserveSig managed method is converted to return HRESULT, the default value is true (the signature should not be converted).
The return value has an unmanaged signature with an additional [out, retval] parameter.
ThrowOnUnmappableChar control pair has been converted to ANSI "?" The unmapped Unicode character of character threw an exception.
Description of IntPtr type
For platform calls, the parameter should be of type IntPtr, not of type String. Use the method provided by the system. Class, you can manually convert a type to a string and manually release it.
IntPtr type is designed as an integer, and its size is suitable for a specific platform.
In 32-bit hardware and operating systems, it will be 32-bit;
In 64-bit hardware and operating systems, it will be 64-bit.
The IntPtr type is used by languages that support pointers, and is used as a general method to reference data between languages that support pointers and languages that do not. It can also be used to hold the handle. For example, the instance of IntPtr is widely used in the system. The IO.FileStream class that holds the file handle.
IntPtr type conforms to CLS, but UIntPtr type does not. Only the IntPtr type can be used in the common language runtime. This type implements the ISerializable interface.