[DllImport("user32.dll",SetLastError=true)]

static extern int GetWindowThreadProcessId(IntPtr hwnd,out int processid);

调用方法:

Microsoft.office.Interop.Excel.Application exeApp = new Microsoft.office.Interop.Excel.Application();

//各种excel操作

exeApp.Visible = False;

//

if(exeApp != null)

{

  exeApp.Quit();

  int pid;

  GetWindowThreadProcessId(new IntPtr(exeApp.Hwnd),out pid);

  System.Diagnostics.Process.GetProcessById(pid).Kill();

}

相关文章:

  • 2021-06-07
  • 2022-12-23
  • 2021-11-29
  • 2021-08-16
  • 2021-07-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-12
  • 2021-09-24
  • 2022-02-28
  • 2022-01-16
相关资源
相似解决方案