gmk_notes吧 关注:2贴子:123
  • 0回复贴,共1

coding 收藏

只看楼主收藏回复

//调用底层函数获取进程标示 [DllImport("User32.dll")] public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int ProcessId); private static bool KillExcel(Microsoft.Office.Interop.Excel.Application theApp) { int id = 0; IntPtr intptr = new IntPtr(theApp.Hwnd); System.Diagnostics.Process p = null; try { GetWindowThreadProcessId(intptr, out id); p = System.Diagnostics.Process.GetProcessById(id); if (p != null) { p.Kill(); p.Dispose(); } return true; } catch (Exception ex) { LogHelper.Error(ex.Message, ex); return false; } }


1楼2015-06-08 16:57回复