用DllImport
[DllImport("KERNEL32.DLL", EntryPoint="MoveFileW", SetLastError=true,
CharSet=CharSet.Unicode, ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern bool MoveFile(String src, String dst);
[DllImport("KERNEL32.DLL", EntryPoint="MoveFileW", SetLastError=true,
CharSet=CharSet.Unicode, ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern bool MoveFile(String src, String dst);
private static extern int MessageBoxA(int hWnd,string Message,string Caption,int Type);
这样不是更简单吗?为什么要像楼上的那么复杂?
如果你对API不需要改变函数名,你只要使用
[DllImport("KERNEL32.DLL")]就行了。