public static BOOL EnumChildWindows(HandleRef hwndParent, EnumChildWindowsCallback lpEnumFunc) { BOOL result = EnumChildWindows(hwndParent.Handle, lpEnumFunc); GC.KeepAlive(hwndParent.Wrapper); return(result); }
public static unsafe BOOL EnumChildWindows(IntPtr hwndParent, EnumChildWindowsCallback lpEnumFunc) { // We pass a function pointer to the native function and supply the callback as // reference data, so that the CLR doesn't need to generate a native code block for // each callback delegate instance (for storing the closure pointer). var gcHandle = GCHandle.Alloc(lpEnumFunc); try { return(EnumChildWindows(hwndParent, &HandleEnumChildWindowsNativeCallback, (IntPtr)gcHandle)); } finally { gcHandle.Free(); } }
public static extern int EnumChildWindows(IntPtr hWnd, EnumChildWindowsCallback callback, int lParam);