16,721
社区成员




[DllImport("User32.dll")]
public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int ProcessId);
public static void KillExcelApp(this excel.Application app)
{
app.Quit();
IntPtr intptr = new IntPtr(app.Hwnd);
int id;
GetWindowThreadProcessId(intptr, out id);
var p = Process.GetProcessById(id);
//if (p != null)
p.Kill();
}