C#获取返回错误码

[DllImport("TestWin32Dll.dll", EntryPoint = "TestFunc",SetLastError = true)]
private static extern void TestFunc();

private void TestPInvoke()
{
  TestFunc();
  int reCode = Marshal.GetLastWin32Error();
  Console.WriteLine(reCode);
}
 

你可能感兴趣的:(C++,c,C#)