I\'ve some library code that is used by both console and WPF apps. In the library code, there are some Console.Read() calls. I only want to do those input rea
Console.Read()
You can use this code:
public static bool HasMainWindow() { return (Process.GetCurrentProcess().MainWindowHandle != IntPtr.Zero); }
Worked fine with quick test on Console vs. WinForms application.