您的位置:首页 > 其它

关于excel 导出进程关闭最有效的方法

2013-05-16 17:29 267 查看
[DllImport("User32.dll",CharSet= CharSet.Auto)]

public static extern int GetWindowThreadProcessId(IntPtr hwnd,out int ID);

//传入一个应用程序excel对象

public static void Kill(Excel.Application excel)

{

  IntPtr t=new IntPtr(excel.Hwnd);

  int k=0;

  GetWindowThreadProcessId(t,out k);

  System.Diagnostics.Process p= System.Diagnostics.Process.GetWindowThreadProcessById(k);

  p.Kill();

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: