public static List <IntPtr> GetTopHandles() { List <IntPtr> handles = new List <IntPtr>(); GCHandle listgc = GCHandle.Alloc(handles); EnumTopWindows callbackPtr = GetTopHandle; EnumWindows(callbackPtr, GCHandle.ToIntPtr(listgc)); listgc.Free(); return(handles); }
private static extern int EnumWindows(EnumTopWindows callPtr, IntPtr lPar);