46 instantiations of HandleRef
System.Private.Windows.Core (1)
Windows\Win32\Foundation\HandleRef.cs (1)
71return new(handle.Wrapper, Unsafe.As<nint, THandle>(ref local));
System.Windows.Forms (40)
System\Windows\Forms\Accessibility\Control.ControlAccessibleObject.cs (2)
472new HandleRef<HWND>(Owner, HandleInternal), 544PInvoke.UiaHostProviderFromHwnd(new HandleRef<HWND>(this, HandleInternal), out IRawElementProviderSimple* provider);
System\Windows\Forms\ActiveX\AxHost.cs (2)
1771if (PInvoke.IsAccelerator(new HandleRef<HACCEL>(this, ctlInfo.hAccel), ctlInfo.cAccel, &msg, lpwCmd: null)) 3142Application.ParkHandle(new HandleRef<HWND>(this, hwnd), DpiAwarenessContext);
System\Windows\Forms\ActiveX\Control.ActiveXImpl.cs (2)
675PInvoke.DestroyAcceleratorTable(new HandleRef<HACCEL>(_control, _accelTable)); 1666PInvoke.DestroyAcceleratorTable(new HandleRef<HACCEL>(_control, _accelTable));
System\Windows\Forms\Control.cs (7)
5225internal static HandleRef<HWND> GetHandleRef(HWND hwnd) => new(FromChildHandle(hwnd), hwnd); 5450hWndChild = PInvoke.GetWindow(new HandleRef<HWND>(this, hWndChild), GET_WINDOW_CMD.GW_HWNDNEXT)) 5771return new(control); 5777? new(window, hwnd) 7095Application.ParkHandle(handle: new(this), DpiAwarenessContext); 7968PInvokeCore.GetClientRect(new HandleRef<HWND>(_window, InternalHandle), out RECT rect); 10280Application.ParkHandle(handle: new(this), DpiAwarenessContext);
System\Windows\Forms\Controls\ComboBox\ComboBox.ACNativeWindow.cs (1)
23PInvokeCore.EnumChildWindows(new HandleRef<HWND>(this, acHandle), RegisterACWindowRecursive);
System\Windows\Forms\Controls\ComboBox\ComboBox.ComboBoxChildEditUiaProvider.cs (1)
88PInvoke.UiaHostProviderFromHwnd(new HandleRef<HWND>(this, _handle), out IRawElementProviderSimple* provider);
System\Windows\Forms\Controls\ComboBox\ComboBox.ComboBoxChildListUiaProvider.cs (1)
183PInvoke.UiaHostProviderFromHwnd(new HandleRef<HWND>(this, _childListControlhandle), out IRawElementProviderSimple* provider);
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (3)
1976return DropDownStyle == ComboBoxStyle.Simple ? new(_childListBox) : new(this, _dropDownHandle); 2295hwnd = PInvoke.GetWindow(new HandleRef<HWND>(this, hwnd), GET_WINDOW_CMD.GW_HWNDNEXT);
System\Windows\Forms\Controls\ImageList\ImageList.cs (5)
215if (PInvoke.ImageList.GetIconSize(new HandleRef<HIMAGELIST>(this, _nativeImageList.HIMAGELIST), out int x, out int y)) 221if (PInvoke.ImageList.GetImageInfo(new HandleRef<HIMAGELIST>(this, _nativeImageList.HIMAGELIST), 0, out IMAGEINFO imageInfo)) 353int index = PInvoke.ImageList.ReplaceIcon(this, -1, new HandleRef<HICON>(icon, (HICON)icon.Handle)); 534new HandleRef<HDC>(g, dc), 670new HandleRef<HDC>(graphics, dc),
System\Windows\Forms\Controls\ImageList\ImageListStreamer.cs (2)
116handle = new(_imageList, (HIMAGELIST)_imageList.Handle); 120handle = new(_nativeImageList, _nativeImageList.HIMAGELIST);
System\Windows\Forms\Controls\ListView\ListView.cs (1)
3802PInvoke.InvalidateRect(new HandleRef<HWND>(this, header), lpRect: null, bErase: true);
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.ModalMenuFilter.cs (4)
141ActiveHwndInternal = new(Control.FromHandle(hwndActive), hwndActive); 260ActiveHwndInternal = new(sender as Control); 414ActiveHwndInternal = new(Control.FromHandle(hwndActive), hwndActive); 536HandleRef<HWND> activeToolStripHandle = new(activeToolStrip);
System\Windows\Forms\Controls\TreeView\TreeView.cs (2)
2005PInvoke.ImageList.Destroy(new HandleRef<HIMAGELIST>(this, (HIMAGELIST)handleOld)); 2016PInvoke.ImageList.Destroy(new HandleRef<HIMAGELIST>(this, (HIMAGELIST)handle));
System\Windows\Forms\Controls\WebBrowser\WebBrowserBase.cs (2)
342if (!PInvoke.IsAccelerator(new HandleRef<HACCEL>(this, controlInfo.hAccel), controlInfo.cAccel, &msg, lpwCmd: null)) 428Application.ParkHandle(new HandleRef<HWND>(AXInPlaceObject, hwndInPlaceObject), DpiAwarenessContext);
System\Windows\Forms\Dialogs\CommonDialogs\CommonDialog.cs (1)
212ownerHwnd = new(nativeWindow, nativeWindow.HWND);
System\Windows\Forms\ErrorProvider\ErrorProvider.ErrorWindow.ErrorWindowAccessibleObject.cs (1)
83PInvoke.UiaHostProviderFromHwnd(new HandleRef<HWND>(this, _owner.HWND), out IRawElementProviderSimple* provider);
System\Windows\Forms\Form.cs (1)
3738: new(OwnerInternal!);
System\Windows\Forms\Help\Help.cs (2)
137HandleRef<HWND> handle = parent is not null ? (new(parent)) : Control.GetHandleRef(PInvoke.GetActiveWindow()); 214HandleRef<HWND> handle = parent is not null ? new(parent) : Control.GetHandleRef(PInvoke.GetActiveWindow());
System.Windows.Forms.Design (3)
System\ComponentModel\Design\DesignerActionUI.cs (1)
723new HandleRef<HWND>(_mainParentWindow, (HWND)_mainParentWindow.Handle));
System\ComponentModel\Design\DesignerActionUI.DesignerActionToolStripDropDown.cs (1)
117new HandleRef<HWND>(this, hwndActivating),
System\Windows\Forms\Design\Behavior\BehaviorService.cs (1)
458PInvoke.SetActiveWindow(new HandleRef<HWND>(hWnd, (HWND)hWnd.Handle));
System.Windows.Forms.Tests (2)
SerializableTypesTests.cs (2)
96Assert.True(PInvoke.ImageList.GetIconSize(new HandleRef<HIMAGELIST>(this, nativeImageList.HIMAGELIST), out int x, out int y)); 99Assert.True(PInvoke.ImageList.GetImageInfo(new HandleRef<HIMAGELIST>(this, nativeImageList.HIMAGELIST), 0, out IMAGEINFO imageInfo));
34 references to HandleRef
System.Private.Windows.Core (9)
Windows\Win32\Foundation\HandleRef.cs (8)
22internal readonly struct HandleRef<THandle> : IHandle<THandle>, IEquatable<HandleRef<THandle>> 42public bool Equals(HandleRef<THandle> other) 49public static bool operator ==(HandleRef<THandle> left, HandleRef<THandle> right) => left.Equals(right); 50public static bool operator !=(HandleRef<THandle> left, HandleRef<THandle> right) => !(left == right); 52public static unsafe explicit operator HandleRef(HandleRef<THandle> handle) 63public static unsafe explicit operator HandleRef<THandle>(HandleRef handle)
Windows\Win32\Foundation\IHandle.cs (1)
44/// <see cref="IHandle{THandle}"/> is on a struct. See <see cref="HandleRef{THandle}"/> for a concrete usage.
System.Windows.Forms (25)
System\Windows\Forms\Application.cs (1)
1194internal static void ParkHandle(HandleRef<HWND> handle, DPI_AWARENESS_CONTEXT dpiAwarenessContext)
System\Windows\Forms\Control.cs (3)
5222/// Creates a <see cref="HandleRef{THandle}"/> for the given <paramref name="hwnd"/>, associating 5225internal static HandleRef<HWND> GetHandleRef(HWND hwnd) => new(FromChildHandle(hwnd), hwnd); 5766internal static HandleRef<HWND> GetSafeHandle(IWin32Window window)
System\Windows\Forms\Controls\ComboBox\ComboBox.ComboBoxItemAccessibleObject.cs (1)
38var listHandle = _owningComboBox.GetListHandle();
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (1)
1974internal HandleRef<HWND> GetListHandle()
System\Windows\Forms\Controls\ImageList\ImageListStreamer.cs (1)
113HandleRef<HIMAGELIST> handle = default;
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDown.cs (1)
1982HandleRef<HWND> activeWindow = ToolStripManager.ModalMenuFilter.ActiveHwnd;
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.ModalMenuFilter.cs (6)
31private HandleRef<HWND> _activeHwnd; 33private HandleRef<HWND> _lastActiveWindow; 60internal static HandleRef<HWND> ActiveHwnd => Instance.ActiveHwndInternal; 76private HandleRef<HWND> ActiveHwndInternal 536HandleRef<HWND> activeToolStripHandle = new(activeToolStrip); 537var activeWindowHandle = Control.GetHandleRef(PInvoke.GetActiveWindow());
System\Windows\Forms\Controls\ToolStrips\ToolStripMenuItem.cs (1)
37private HandleRef<HWND> _targetWindowHandle;
System\Windows\Forms\Dialogs\CommonDialogs\CommonDialog.cs (1)
193HandleRef<HWND> ownerHwnd = default;
System\Windows\Forms\Dialogs\MessageBox.cs (1)
456HandleRef<HWND> handle = default;
System\Windows\Forms\Form.cs (3)
3736HandleRef<HWND> ownerHandle = dialogOwner is not null 5498HandleRef<HWND> ownerHwnd = owner is null ? GetHandleRef(activeHwnd) : GetSafeHandle(owner); 5710HandleRef<HWND> ownerHwnd = owner is null ? GetHandleRef(activeHwnd) : GetSafeHandle(owner);
System\Windows\Forms\Help\Help.cs (2)
137HandleRef<HWND> handle = parent is not null ? (new(parent)) : Control.GetHandleRef(PInvoke.GetActiveWindow()); 214HandleRef<HWND> handle = parent is not null ? new(parent) : Control.GetHandleRef(PInvoke.GetActiveWindow());
System\Windows\Forms\ToolTip\ToolTip.cs (3)
987private ToolInfoWrapper<HandleRef<HWND>> GetWinTOOLINFO(IWin32Window window) 1532ToolInfoWrapper<HandleRef<HWND>> info = new(Control.GetSafeHandle(ownerWindow)); 1737ToolInfoWrapper<HandleRef<HWND>> info = new(Control.GetSafeHandle(win));