//Calling the underlying function to get the process label
[DllImport("")]
public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int ProcessId);
private static void KillExcel( theApp)
{
int id = 0;
IntPtr intptr = new IntPtr();
p = null;
try
{
GetWindowThreadProcessId(intptr, out id);
p = (id);
if (p != null)
{
();
();
}
}
catch (Exception ex)
{
}
}