Exemple #1
0
 /// <summary>
 /// Creates desktop object on which window <paramref name="hWnd"/> is displayed
 /// </summary>
 /// <exception cref="ArgumentNullException"><paramref name="hWnd"/> is <c>default</c>.</exception>
 public static Desktop FromWindow(IntPtr hWnd)
 {
     try
     {
         return(FromWindowInternal(hWnd));
     }
     catch (COMException exception) when((uint)exception.HResult == 0x800706BA)
     {
         DesktopManager.Initialize();
         return(FromWindowInternal(hWnd));
     }
 }
Exemple #2
0
 /// <summary>
 /// Create desktop object from index
 /// </summary>
 /// <param name="index">0..Count-1</param>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> is out of range.</exception>
 public static Desktop FromIndex(int index)
 {
     return(new Desktop(DesktopManager.GetDesktop(index)));
 }