public void FocusFirstInstance() { IntPtr ourHwnd = this.ReadHandleFromFromMappedFile(); if (ourHwnd != IntPtr.Zero) { if (SafeNativeMethods.IsIconic(ourHwnd)) { SafeNativeMethods.ShowWindow(ourHwnd, NativeConstants.SW_RESTORE); } SafeNativeMethods.SetForegroundWindow(ourHwnd); } }