コード例 #1
0
 public static List <IntPtr> EnumWindows()
 {
     try
     {
         List <IntPtr>    items       = new List <IntPtr>();
         EnumWindowsProcD CallBackPtr = new EnumWindowsProcD(EnumWindowsProc);
         GCHandle         hItems      = GCHandle.Alloc(items);
         IntPtr           lItems      = GCHandle.ToIntPtr(hItems);
         EnumWindows(CallBackPtr, ref lItems);
         return(items);
     }
     catch (Exception ex)
     {
         throw new Exception("An error occured during window enumeration: " + ex.Message);
     }
 }
コード例 #2
0
 public static extern bool EnumWindows(EnumWindowsProcD lpEnumFunc, ref IntPtr lParam);