Date: 01.03.2018 10:46:15
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)] public static extern uint GetWindowThreadProcessId(int hWnd, ref int lpdwProcessId); public static void ExcelKill() { int excelProcessId=0; GetWindowThreadProcessId(ObjExcel.Hwnd, ref excelProcessId); var process = System.Diagnostics.Process.GetProcessById(excelProcessId); process.Kill(); }
Автор: VadimTagil