public SecondDisplayProcess TransformProcessForDisplay(IntPtr hwnd) { SecondDisplayProcess result; result = CachedProcesses.Get(hwnd.ToInt32()); if (result != null) { return(result); } result = new SecondDisplayProcess(); result.MainWindowHandle = hwnd; result.Title = Native.GetWindowText(hwnd); result.Icon = Native.GetIcon(hwnd); result.SmallIcon = Native.GetSmallIcon(hwnd); result.Path = ProcessUtil.GetProcessPathByWindowHandle(hwnd); if (result.SmallIcon == null) { result.SmallIcon = result.Icon; } if (result.Title.Length == 0 || result.Icon == null) { return(null); } return(CachedProcesses.Add(hwnd.ToInt32(), result)); }
private SecondDisplayProcess TransformProcessForDisplay(Win32Window window) { SecondDisplayProcess result; result = CachedProcesses.Get(window.Handle.ToInt32()); if (result != null) { return(result); } result = SecondDisplayProcess.FromHandle(window.Handle); if (result.Title.Length == 0 || result.Icon == null || string.IsNullOrEmpty(result.Path)) { return(null); } return(CachedProcesses.Add(window.Handle.ToInt32(), result)); }