Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Runtime.InteropServices;
using System.Threading;
using EnvDTE;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DteTestClassNamespace
{
[TestClass]
public class DteTestClass
IntPtr hWnd = IntPtr.Zero;
Process currentProcess = Process.GetCurrentProcess();
Process[] processes = Process.GetProcessesByName(currentProcess.ProcessName);
foreach (Process process in processes)
{
// Get the first instance that is not this instance, has the
// same process name and was started from the same file name
// and location.
// Also check that the process has a valid