public static bool EnumerateWindows <T>(EnumWindowHandler <T> handler, T arg) { var enumData = new EnumWindowData <T>(handler, arg); var gcHandle = GCHandle.Alloc(enumData, GCHandleType.Normal); try { return(NativeMethods.EnumWindows(EnumWinProc <T>, GCHandle.ToIntPtr(gcHandle))); } finally { gcHandle.Free(); } }
public EnumWindowData(EnumWindowHandler <T> handler, T argument) { Handler = handler; Argument = argument; }