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