378 references to NativeMethods
aspire-tray (378)
FolderApplication.cs (2)
122Marshal.ThrowExceptionForHR(NativeMethods.ParseDisplayName(path, 0, out var item, 0, out _)); 125Marshal.ThrowExceptionForHR(NativeMethods.OpenFolderAndSelectItems(item, 0, 0, 0));
NativeMethods.Automation.cs (4)
148NativeMethods.ProviderOptions get_ProviderOptions(); 168IRawElementProviderFragment? Navigate(NativeMethods.NavigateDirection direction); 173NativeMethods.UiaRect get_BoundingRectangle(); 204NativeMethods.ToggleState get_ToggleState();
Program.cs (2)
156NativeMethods.OutputDebugString($"Tray diagnostic write failed ({ex.GetType().Name}).{Environment.NewLine}"); 158NativeMethods.OutputDebugString(message + Environment.NewLine);
TrayApplication.Actions.cs (3)
101ShowMessage("Aspire", ex.Message, NativeMethods.MbIconError); 158NativeCallException.Require(NativeMethods.MessageBox(_modalOwner, detail, title, flags) != 0, "MessageBoxW"); 177var result = NativeMethods.ShellExecute(_window, "open", uri.AbsoluteUri, null, null, 1);
TrayApplication.Clipboard.cs (8)
20var memory = NativeMethods.GlobalAlloc(0x2, checked((nuint)(path.Length + 1) * sizeof(char))); 24var buffer = NativeMethods.GlobalLock(memory); 30var unlocked = NativeMethods.GlobalUnlock(memory); 32NativeCallException.Require(NativeMethods.OpenClipboard(_window) != 0, "OpenClipboard"); 35NativeCallException.Require(NativeMethods.EmptyClipboard() != 0, "EmptyClipboard"); 36NativeCallException.Require(NativeMethods.SetClipboardData(13, memory) != 0, "SetClipboardData"); 41NativeCallException.Require(NativeMethods.CloseClipboard() != 0, "CloseClipboard"); 48Cleanup(NativeMethods.GlobalFree(memory) == 0, "GlobalFree(clipboard)");
TrayApplication.cs (72)
36private NativeMethods.NotifyIconData _iconData; 62if (_window != 0 && NativeMethods.PostMessage(_window, NativeMethods.RestoreMessage, 0, 0) == 0) 76if (_window != 0 && !_loopEnded && NativeMethods.PostMessage(_window, NativeMethods.QuitMessage, 0, 0) == 0) 89|| sizeof(NativeMethods.WindowClass) != 72 || sizeof(NativeMethods.Message) != 48 90|| sizeof(NativeMethods.NotifyIconData) != 976 91|| sizeof(NativeMethods.IconInfo) != 32 || sizeof(NativeMethods.BitmapInfo) != 44 92|| sizeof(NativeMethods.ToolInfo) != 72) 107var result = NativeMethods.GetMessage(out var message, 0, 0, 0); 113NativeMethods.TranslateMessage(in message); 114NativeMethods.DispatchMessage(in message); 134_previousDpiContext = NativeMethods.SetThreadDpiAwarenessContext(-4); 136_module = NativeMethods.GetModuleHandle(null); 138_taskbarCreated = NativeMethods.RegisterWindowMessage("TaskbarCreated"); 142var windowClass = new NativeMethods.WindowClass 146NativeCallException.Require(NativeMethods.RegisterClass(ref windowClass) != 0, "RegisterClassW"); 150var window = NativeMethods.CreateWindowEx(0, ClassName, "Aspire Tray", 0, 0, 0, 0, 0, 0, 0, _module, 0); 156_iconData = new NativeMethods.NotifyIconData 158Size = (uint)sizeof(NativeMethods.NotifyIconData), Window = window, Id = 1, 159Flags = NativeMethods.NifMessage | NativeMethods.NifIcon | NativeMethods.NifTip | NativeMethods.NifShowTip, 160CallbackMessage = NativeMethods.TrayCallback 178_timerAdded = NativeMethods.SetTimer(window, TimerId, 200, 0) != 0; 183NativeCallException.Require(NativeMethods.PostMessage(window, NativeMethods.ReadyMessage, 0, 0) != 0, "PostMessageW(ready)"); 194if (NativeMethods.PostMessage(_window, NativeMethods.RefreshMessage, 0, 0) == 0) 210var replacement = new Artwork(this, NativeMethods.GetDpiForWindow(_window)); 230if (NativeMethods.ShellNotifyIcon(NativeMethods.NimAdd, ref _iconData) == 0) 239_iconData.Version = NativeMethods.NotifyIconVersion4; 240if (NativeMethods.ShellNotifyIcon(NativeMethods.NimSetVersion, ref _iconData) == 0) 263if (NativeMethods.ShellNotifyIcon(NativeMethods.NimModify, ref _iconData) == 0) 307NativeMethods.PostQuitMessage(1); 311return NativeMethods.DefWindowProc(window, message, wParam, lParam); 325case NativeMethods.ReadyMessage: 336case NativeMethods.RefreshMessage: 343case NativeMethods.RestoreMessage: 346case NativeMethods.QuitMessage: 349case NativeMethods.WmTimer when wParam == TimerId: 352case NativeMethods.WmDpiChanged: 353case NativeMethods.WmSettingChange: 354case NativeMethods.WmSysColorChange: 355case NativeMethods.WmThemeChanged: 360case NativeMethods.TrayCallback when !_quitRequested && _modalDepth == 0: 368if (notification is NativeMethods.NinSelect or NativeMethods.WmContextMenu or NativeMethods.NinKeySelect) 370TogglePanel(keyboard: notification == NativeMethods.NinKeySelect 371|| (notification == NativeMethods.WmContextMenu && IsKeyboardContextMenu())); 374case NativeMethods.WmClose: 375case NativeMethods.WmDestroy: 376case NativeMethods.WmEndSession when wParam != 0: 380return NativeMethods.DefWindowProc(window, message, wParam, lParam); 442Cleanup(NativeMethods.PostMessage(popup, NativeMethods.WmClose, 0, 0) != 0, "PostMessageW(close dialog)"); 445NativeMethods.PostQuitMessage(ExitCode); 453return NativeMethods.GetWindow(owner, NativeMethods.GwEnabledPopup); 489Cleanup(NativeMethods.KillTimer(_window, TimerId) != 0, "KillTimer"); 493Cleanup(NativeMethods.ShellNotifyIcon(NativeMethods.NimDelete, ref _iconData) != 0, "Shell_NotifyIconW(NIM_DELETE)"); 500if (NativeMethods.DestroyWindow(_window) == 0) 507if (_classRegistered && NativeMethods.UnregisterClass(ClassName, _module) == 0) 515Cleanup(NativeMethods.SetThreadDpiAwarenessContext(_previousDpiContext) != 0, "SetThreadDpiAwarenessContext(restore)");
TrayApplication.Icons.cs (21)
23if (_iconAdded && NativeMethods.ShellNotifyIcon(NativeMethods.NimModify, ref _iconData) == 0) 43Size = NativeMethods.GetSystemMetricsForDpi(NativeMethods.SmCxSmallIcon, dpi); 47var original = NativeMethods.LoadImage(0, Path.Combine(AppContext.BaseDirectory, "Aspire.ico"), 48NativeMethods.ImageIcon, Size, Size, NativeMethods.LrLoadFromFile); 119var mask = NativeMethods.CreateBitmap(Size, Size, 1, 1, (nint)maskBits); 123var info = new NativeMethods.IconInfo { IsIcon = 1, Color = canvas.Handle, Mask = mask }; 124var icon = NativeMethods.CreateIconIndirect(ref info); 131_owner.Cleanup(NativeMethods.DeleteObject(mask) != 0, "DeleteObject(icon mask)"); 145_owner.Cleanup(NativeMethods.DestroyIcon(icon) != 0, "DestroyIcon"); 161var info = new NativeMethods.BitmapInfo 165Handle = NativeMethods.CreateDIBSection(0, ref info, 0, out var bits, 0, 0); 232var dc = NativeMethods.CreateCompatibleDC(0); 237previous = NativeMethods.SelectObject(dc, Handle); 239NativeCallException.Require(NativeMethods.DrawIconEx(dc, 0, 0, icon, _size, _size, 0, 0, 3) != 0, "DrawIconEx"); 241NativeCallException.Require(NativeMethods.GdiFlush() != 0, "GdiFlush"); 247_owner.Cleanup(NativeMethods.SelectObject(dc, previous) != 0, "SelectObject(restore)"); 249_owner.Cleanup(NativeMethods.DeleteDC(dc) != 0, "DeleteDC"); 257_owner.Cleanup(NativeMethods.DeleteObject(Handle) != 0, "DeleteObject(canvas)");
TrayApplication.NativeSmoke.cs (54)
20var data = new NativeMethods.NotifyIconData 22Size = (uint)sizeof(NativeMethods.NotifyIconData), 28Icon = NativeMethods.LoadIcon(0, 32512) 31Program.Log($"C# NOTIFYICONDATAW architecture={RuntimeInformation.ProcessArchitecture} size={sizeof(NativeMethods.NotifyIconData)} " 36var added = NativeMethods.ShellNotifyIcon(NativeMethods.NimAdd, ref data); 40NativeCallException.Require(NativeMethods.ShellNotifyIcon(NativeMethods.NimDelete, ref data) != 0, "Shell_NotifyIconW(smoke control delete)"); 43static nint Offset(string field) => Marshal.OffsetOf<NativeMethods.NotifyIconData>(field); 124NativeCallException.Require(NativeMethods.GetWindowRect(_panelWindow, out var rect) != 0, "GetWindowRect(capture)"); 129var screen = NativeMethods.GetDC(0); 131var memory = NativeMethods.CreateCompatibleDC(screen); 132var bitmap = NativeMethods.CreateCompatibleBitmap(screen, width, height); 135var previous = NativeMethods.SelectObject(memory, bitmap); 137NativeCallException.Require(NativeMethods.BitBlt(memory, 0, 0, width, height, screen, rect.Left, rect.Top, 0x00CC0020 | 0x40000000) != 0, 139NativeMethods.SelectObject(memory, previous); 140RequireGdiplus(NativeMethods.GdipCreateBitmapFromHBITMAP(bitmap, 0, out var image), "GdipCreateBitmapFromHBITMAP"); 143RequireGdiplus(NativeMethods.GdipSaveImageToFile(image, path, in s_pngEncoder, 0), "GdipSaveImageToFile"); 147NativeMethods.GdipDisposeImage(image); 153Cleanup(NativeMethods.DeleteObject(bitmap) != 0, "DeleteObject(capture)"); 154Cleanup(NativeMethods.DeleteDC(memory) != 0, "DeleteDC(capture)"); 155NativeMethods.ReleaseDC(0, screen); 179var defaultId = (nuint)NativeMethods.SendMessage(dialog, 0x400, 0, 0); 182var button = NativeMethods.GetDlgItem(dialog, pending.Response); 186NativeCallException.Require(NativeMethods.PostMessage(dialog, NativeMethods.WmCommand, (nuint)pending.Response, button) != 0, "PostMessageW(smoke dialog response)"); 234NativeMethods.SendMessage(_panelWindow, NativeMethods.WmMouseMove, 0, point); 235NativeMethods.SendMessage(_panelWindow, NativeMethods.WmLeftButtonDown, 1, point); 236NativeMethods.SendMessage(_panelWindow, NativeMethods.WmLeftButtonUp, 0, point); 247NativeMethods.SendMessage(_panelWindow, NativeMethods.WmKeyDown, (nuint)virtualKey, 0); 285NativeMethods.UpdateWindow(_panelWindow); 322(NativeMethods.NinSelect, false), (NativeMethods.WmContextMenu, null), (NativeMethods.NinKeySelect, true) 328NativeMethods.SendMessage(_window, NativeMethods.TrayCallback, 0, (nint)notification); 332NativeMethods.SendMessage(_window, NativeMethods.TrayCallback, 0, (nint)notification); 335NativeMethods.SendMessage(_window, NativeMethods.TrayCallback, 0, (nint)notification); 347NativeCallException.Require(NativeMethods.GetKeyboardState(state) != 0, "GetKeyboardState(smoke)"); 350NativeCallException.Require(NativeMethods.SetKeyboardState(state) != 0, "SetKeyboardState(smoke)"); 358NativeMethods.SetKeyboardState(state); 407NativeCallException.Require(NativeMethods.ShellNotifyIcon(NativeMethods.NimDelete, ref _iconData) != 0, "Shell_NotifyIconW(smoke delete)"); 409NativeMethods.SendMessage(_window, _taskbarCreated, 0, 0); 417NativeMethods.SendMessage(_window, NativeMethods.WmDpiChanged, 0, 0); 445NativeSmokeHarness.Require(_iconData.CallbackMessage == NativeMethods.TrayCallback, "The icon must report activations to the panel."); 450&& NativeMethods.SendMessage(_panelTooltip, 0x040D, 0, 0) == _panelTooltips.Count, // TTM_GETTOOLCOUNT
TrayApplication.Panel.cs (149)
38private List<(NativeMethods.Rect Bounds, string Text)> _panelTooltips = []; 85if (NativeMethods.SetForegroundWindow(_panelWindow) == 0) 91NativeMethods.SetFocus(_panelWindow); 102if (NativeMethods.GetKeyState(0x5D) < 0 || NativeMethods.GetKeyState(0x79) < 0) // VK_APPS, VK_F10 106var identifier = new NativeMethods.NotifyIconIdentifier 108Size = (uint)sizeof(NativeMethods.NotifyIconIdentifier), Window = _window, Id = 1 110return NativeMethods.ShellNotifyIconGetRect(in identifier, out var icon) >= 0 111&& NativeMethods.GetCursorPos(out var point) != 0 123NativeMethods.ShowWindow(_panelWindow, 0); // SW_HIDE 132var input = new NativeMethods.GdiplusStartupInput { GdiplusVersion = 1 }; 133if (NativeMethods.GdiplusStartup(out _gdiplusToken, in input, 0) != 0) 139var windowClass = new NativeMethods.WindowClass 141Style = NativeMethods.CsDropShadow, 144Cursor = NativeMethods.LoadCursor(0, 32512), // IDC_ARROW 147NativeCallException.Require(NativeMethods.RegisterClass(ref windowClass) != 0, "RegisterClassW(flyout)"); 153_panelWindow = NativeMethods.CreateWindowEx(NativeMethods.WsExToolWindow | NativeMethods.WsExTopmost, PanelClassName, "Aspire", 154NativeMethods.WsPopup, 0, 0, 1, 1, _window, 0, _module, 0); 160_panelUsesDwmCorners = NativeMethods.DwmSetWindowAttribute(_panelWindow, 33, &preference, sizeof(int)) >= 0; 166var center = new NativeMethods.Point { X = (anchor.Left + anchor.Right) / 2, Y = (anchor.Top + anchor.Bottom) / 2 }; 167var monitor = NativeMethods.MonitorFromPoint(center, 2); // MONITOR_DEFAULTTONEAREST 168var info = new NativeMethods.MonitorInfo { Size = (uint)sizeof(NativeMethods.MonitorInfo) }; 169NativeCallException.Require(NativeMethods.GetMonitorInfo(monitor, ref info) != 0, "GetMonitorInfoW(flyout)"); 170if (NativeMethods.GetDpiForMonitor(monitor, 0, out var dpi, out _) < 0 || dpi == 0) 172dpi = NativeMethods.GetDpiForWindow(_window); 213NativeCallException.Require(NativeMethods.SetWindowPos(_panelWindow, -1, x, y, width, height, show ? 0x40u : 0x10u) != 0, 218var region = NativeMethods.CreateRoundRectRgn(0, 0, width + 1, height + 1, diameter, diameter); 220if (region != 0 && NativeMethods.SetWindowRgn(_panelWindow, region, 1) == 0) 222Cleanup(NativeMethods.DeleteObject(region) != 0, "DeleteObject(region)"); 225NativeMethods.InvalidateRect(_panelWindow, 0, 0); 240var controls = new NativeMethods.CommonControls 242Size = (uint)sizeof(NativeMethods.CommonControls), Classes = NativeMethods.IccBarClasses 244NativeCallException.Require(NativeMethods.InitCommonControlsEx(in controls) != 0, "InitCommonControlsEx"); 246_panelTooltip = NativeMethods.CreateWindowEx(NativeMethods.WsExTopmost, "tooltips_class32", "", 247NativeMethods.WsPopup | NativeMethods.TtsAlwaysTip | NativeMethods.TtsNoPrefix, 0, 0, 0, 0, _panelWindow, 0, _module, 0); 258var tool = new NativeMethods.ToolInfo { Size = (uint)sizeof(NativeMethods.ToolInfo), Window = _panelWindow, Id = (nuint)i }; 259NativeMethods.SendMessage(_panelTooltip, NativeMethods.TtmDelTool, 0, (nint)(&tool)); 267var tool = new NativeMethods.ToolInfo 269Size = (uint)sizeof(NativeMethods.ToolInfo), 270Flags = NativeMethods.TtfSubclass, 276NativeCallException.Require(NativeMethods.SendMessage(_panelTooltip, NativeMethods.TtmAddTool, 0, (nint)(&tool)) != 0, 282private NativeMethods.Rect GetNotifyIconRect() 284var identifier = new NativeMethods.NotifyIconIdentifier 286Size = (uint)sizeof(NativeMethods.NotifyIconIdentifier), Window = _window, Id = 1 288if (NativeMethods.ShellNotifyIconGetRect(in identifier, out var rect) >= 0) 293NativeCallException.Require(NativeMethods.GetCursorPos(out var point) != 0, "GetCursorPos(flyout)"); 314NativeMethods.GetWindowRect(_panelWindow, out var rect); 321NativeMethods.InvalidateRect(_panelWindow, 0, 0); 396var contrast = new NativeMethods.HighContrast { Size = (uint)sizeof(NativeMethods.HighContrast) }; 397if (NativeMethods.GetHighContrast(0x42, contrast.Size, ref contrast, 0) != 0 && (contrast.Flags & 1) != 0) 406var value = NativeMethods.GetSysColor(index); 429var dc = NativeMethods.BeginPaint(_panelWindow, out var paint); 436NativeMethods.GetClientRect(_panelWindow, out var client); 440var memory = NativeMethods.CreateCompatibleDC(dc); 442var bitmap = NativeMethods.CreateCompatibleBitmap(dc, width, height); 446var previous = NativeMethods.SelectObject(memory, bitmap); 448NativeCallException.Require(NativeMethods.BitBlt(dc, 0, 0, width, height, memory, 0, 0, 0x00CC0020) != 0, "BitBlt(flyout)"); // SRCCOPY 449NativeMethods.SelectObject(memory, previous); 455Cleanup(NativeMethods.DeleteObject(bitmap) != 0, "DeleteObject(flyout bitmap)"); 457Cleanup(NativeMethods.DeleteDC(memory) != 0, "DeleteDC(flyout)"); 462NativeMethods.EndPaint(_panelWindow, in paint); 471RequireGdiplus(NativeMethods.GdipCreateFromHDC(dc, out var graphics), "GdipCreateFromHDC"); 476RequireGdiplus(NativeMethods.GdipSetSmoothingMode(graphics, 4), "GdipSetSmoothingMode"); 477RequireGdiplus(NativeMethods.GdipSetPixelOffsetMode(graphics, 4), "GdipSetPixelOffsetMode"); 478RequireGdiplus(NativeMethods.GdipScaleWorldTransform(graphics, scale, scale, 0), "GdipScaleWorldTransform"); 504NativeMethods.DrawIconEx(gdi, rect.Left, rect.Top, icon, rect.Right - rect.Left, rect.Bottom - rect.Top, 0, 0, 3) != 0, 523RequireGdiplus(NativeMethods.GdipSaveGraphics(graphics, out var state), "GdipSaveGraphics"); 525RequireGdiplus(NativeMethods.GdipSetClipRect(graphics, (float)clip.Bounds.X, (float)clip.Bounds.Y, 530RequireGdiplus(NativeMethods.GdipRestoreGraphics(graphics, clips.Pop().State), "GdipRestoreGraphics"); 537NativeMethods.GdipDeleteGraphics(graphics); 546RequireGdiplus(NativeMethods.GdipGetDC(graphics, out var dc), "GdipGetDC"); 547var saved = NativeMethods.SaveDC(dc); 553NativeMethods.IntersectClipRect(dc, clip.Left, clip.Top, clip.Right, clip.Bottom); 559NativeMethods.RestoreDC(dc, saved); 560NativeMethods.GdipReleaseDC(graphics, dc); 569RequireGdiplus(NativeMethods.GdipCreateSolidFill(ToArgb(color), out var brush), "GdipCreateSolidFill"); 572RequireGdiplus(NativeMethods.GdipFillPath(graphics, brush, path), "GdipFillPath"); 576NativeMethods.GdipDeleteBrush(brush); 581NativeMethods.GdipDeletePath(path); 591RequireGdiplus(NativeMethods.GdipCreatePen1(ToArgb(color), (float)width, 0, out var pen), "GdipCreatePen1"); 594RequireGdiplus(NativeMethods.GdipSetPenLineCap197819(pen, 2, 2, 2), "GdipSetPenLineCap"); 595RequireGdiplus(NativeMethods.GdipSetPenLineJoin(pen, 2), "GdipSetPenLineJoin"); 596RequireGdiplus(NativeMethods.GdipDrawPath(graphics, pen, path), "GdipDrawPath"); 600NativeMethods.GdipDeletePen(pen); 605NativeMethods.GdipDeletePath(path); 617var points = new List<NativeMethods.PointF>(); 646fixed (NativeMethods.PointF* pointData = pointArray) 650RequireGdiplus(NativeMethods.GdipCreatePath2(pointData, typeData, pointArray.Length, 0, out var path), "GdipCreatePath2"); 658var previous = NativeMethods.SelectObject(dc, font); 661NativeMethods.SetBkMode(dc, 1); // TRANSPARENT 664NativeMethods.SetTextColor(dc, (uint)(color.R | (color.G << 8) | (color.B << 16))); 685NativeCallException.Require(NativeMethods.GetTextMetrics(dc, out var metrics) != 0, "GetTextMetricsW(flyout)"); 692NativeMethods.DrawText(dc, value, value.Length, ref rect, format); 696NativeMethods.SelectObject(dc, previous); 741var rect = new NativeMethods.Rect(); 743NativeMethods.DrawText(dc, value, value.Length, ref rect, 0x400 | 0x20 | 0x800); 755Cleanup(NativeMethods.DestroyIcon(_panelLogo) != 0, "DestroyIcon(flyout logo)"); 757_panelLogo = NativeMethods.LoadImage(0, Path.Combine(AppContext.BaseDirectory, "Aspire.ico"), 758NativeMethods.ImageIcon, size, size, NativeMethods.LrLoadFromFile); 762NativeCallException.Require(NativeMethods.DrawIconEx(dc, rect.Left, rect.Top, _panelLogo, size, size, 0, 0, 3) != 0, 776if (executable is null || NativeMethods.SHDefExtractIcon(executable, 0, 0, out icon, null, (uint)size) != 0) 795font = NativeMethods.CreateFont(height, 0, 0, 0, weight, 0, 0, 0, 1, 0, 0, 5, 0, _panelFontFace); 800Cleanup(NativeMethods.DeleteObject(font) != 0, "DeleteObject(flyout font)"); 809var previous = NativeMethods.SelectObject(dc, font); 813var length = NativeMethods.GetTextFace(dc, 64, buffer); 818NativeMethods.SelectObject(dc, previous); 823private NativeMethods.Rect ToDevice(PanelRect rect) 849return NativeMethods.DefWindowProc(window, message, wParam, lParam); 856case NativeMethods.WmPaint: 859case NativeMethods.WmEraseBackground: 861case NativeMethods.WmMouseMove: 865var track = new NativeMethods.TrackMouseEventData 867Size = (uint)sizeof(NativeMethods.TrackMouseEventData), Flags = 2, Window = window 869_panelTrackingMouse = NativeMethods.TrackMouseEvent(ref track) != 0; 873case NativeMethods.WmMouseLeave: 877case NativeMethods.WmLeftButtonDown: 878NativeMethods.SetCapture(window); 881case NativeMethods.WmLeftButtonUp: 882NativeMethods.ReleaseCapture(); 885case NativeMethods.WmMouseWheel: 890case NativeMethods.WmKeyDown when wParam == 0xBC && NativeMethods.GetKeyState(0x11) < 0: 897case NativeMethods.WmKeyDown: 9020x09 => NativeMethods.GetKeyState(0x10) < 0 ? PanelKey.ShiftTab : PanelKey.Tab, 916case NativeMethods.WmActivate when (wParam & 0xFFFF) == 0 && _previewExport is null: 921case NativeMethods.WmDpiChanged when _panelVisible: 924case NativeMethods.WmGetObject when unchecked((int)lParam) == NativeMethods.UiaRootObjectId: 930return NativeMethods.DefWindowProc(window, message, wParam, lParam); 937Cleanup(NativeMethods.DestroyWindow(_panelTooltip) != 0, "DestroyWindow(flyout tooltip)"); 944Cleanup(NativeMethods.DestroyWindow(_panelWindow) != 0, "DestroyWindow(flyout)"); 949Cleanup(NativeMethods.UnregisterClass(PanelClassName, _module) != 0, "UnregisterClassW(flyout)"); 954Cleanup(NativeMethods.DeleteObject(font) != 0, "DeleteObject(flyout font)"); 959Cleanup(NativeMethods.DestroyIcon(_panelLogo) != 0, "DestroyIcon(flyout logo)"); 964Cleanup(NativeMethods.DestroyIcon(icon) != 0, "DestroyIcon(application icon)"); 969NativeMethods.GdiplusShutdown(_gdiplusToken); 997return NativeMethods.DefWindowProc(window, message, wParam, lParam);
TrayApplication.PanelAutomation.cs (63)
40return NativeMethods.UiaReturnRawElementProvider(window, wParam, lParam, provider); 66var listening = NativeMethods.UiaClientsAreListening(); 97WithSimpleProvider(node, NativeMethods.UiaDisconnectProvider); 113RaisePropertyChanged(node, NativeMethods.UiaToggleToggleStatePropertyId, 118RaisePropertyChanged(node, NativeMethods.UiaNamePropertyId, ComVariant.Create(previous.Name), ComVariant.Create(element.Name)); 129var result = NativeMethods.UiaRaiseStructureChangedEvent(root, NativeMethods.StructureChangeType.ChildrenInvalidated, rootId, 2); 145WithSimpleProvider(focused, provider => NativeMethods.UiaRaiseAutomationEvent(provider, NativeMethods.UiaAutomationFocusChangedEventId)); 153WithSimpleProvider(node, provider => NativeMethods.UiaRaiseAutomationPropertyChangedEvent(provider, property, 154NativeMethods.NativeVariant.From(oldValue), NativeMethods.NativeVariant.From(newValue))); 173NativeMethods.GetWindowRect(_panelWindow, out var window); 187private NativeMethods.UiaRect ToScreenRect(PanelRect bounds) 189NativeMethods.GetWindowRect(_panelWindow, out var window); 216NativeMethods.UiaReturnRawElementProvider(_panelWindow, 0, 0, 0); 220WithSimpleProvider(node, NativeMethods.UiaDisconnectProvider); 222WithSimpleProvider(_automationRoot, NativeMethods.UiaDisconnectProvider); 230private static NativeMethods.ToggleState ToToggleState(bool? value) => value == true ? NativeMethods.ToggleState.On : NativeMethods.ToggleState.Off; 271public NativeMethods.ProviderOptions get_ProviderOptions() => NativeMethods.ProviderOptions.ServerSideProvider; 279NativeMethods.UiaControlTypePropertyId => Variant(NativeMethods.UiaPaneControlTypeId), 280NativeMethods.UiaNamePropertyId => Variant("Aspire"), 281NativeMethods.UiaFrameworkIdPropertyId => Variant("Aspire"), 289Marshal.ThrowExceptionForHR(NativeMethods.UiaHostProviderFromHwnd(owner._panelWindow, out var host)); 293public IRawElementProviderFragment? Navigate(NativeMethods.NavigateDirection direction) => direction switch 295NativeMethods.NavigateDirection.FirstChild => owner._automationOrder.FirstOrDefault(), 296NativeMethods.NavigateDirection.LastChild => owner._automationOrder.LastOrDefault(), 302public NativeMethods.UiaRect get_BoundingRectangle() => default; 330public NativeMethods.ProviderOptions get_ProviderOptions() => NativeMethods.ProviderOptions.ServerSideProvider; 338(NativeMethods.UiaInvokePatternId, PanelAccessibleRole.Button) => (nint)ComInterfaceMarshaller<IInvokeProvider>.ConvertToUnmanaged(this), 339(NativeMethods.UiaTogglePatternId, PanelAccessibleRole.Switch) => (nint)ComInterfaceMarshaller<IToggleProvider>.ConvertToUnmanaged(this), 349return NativeMethods.UiaElementNotAvailable; 354NativeMethods.UiaControlTypePropertyId => Variant(element.Role switch 356PanelAccessibleRole.Switch => NativeMethods.UiaCheckBoxControlTypeId, 357PanelAccessibleRole.Text => NativeMethods.UiaTextControlTypeId, 358_ => NativeMethods.UiaButtonControlTypeId 360NativeMethods.UiaNamePropertyId => Variant(element.Name), 361NativeMethods.UiaAutomationIdPropertyId => Variant(element.Target?.Kind.ToString() ?? element.Key.Label), 362NativeMethods.UiaHelpTextPropertyId => Variant(element.Description), 363NativeMethods.UiaIsEnabledPropertyId => Variant(element.Enabled), 364NativeMethods.UiaIsKeyboardFocusablePropertyId => Variant(element.Target is { Enabled: true }), 365NativeMethods.UiaHasKeyboardFocusPropertyId => Variant(IsFocused), 366NativeMethods.UiaIsOffscreenPropertyId => Variant(element.IsOffscreen), 367NativeMethods.UiaFrameworkIdPropertyId => Variant("Aspire"), 375public IRawElementProviderFragment? Navigate(NativeMethods.NavigateDirection direction) 382NativeMethods.NavigateDirection.Parent => owner._automationRoot, 383NativeMethods.NavigateDirection.NextSibling when index >= 0 && index + 1 < siblings.Count => siblings[index + 1], 384NativeMethods.NavigateDirection.PreviousSibling when index > 0 => siblings[index - 1], 393var array = NativeMethods.SafeArrayCreateVector(3, 0, 2); // VT_I4 398Marshal.ThrowExceptionForHR(NativeMethods.SafeArrayAccessData(array, out var data)); 399((int*)data)[0] = NativeMethods.UiaAppendRuntimeId; 401Marshal.ThrowExceptionForHR(NativeMethods.SafeArrayUnaccessData(array)); 405public NativeMethods.UiaRect get_BoundingRectangle() 433if (NativeMethods.PostMessage(owner._panelWindow, WmPanelAutomationInvoke, (nuint)id, 0) == 0) 446public NativeMethods.ToggleState get_ToggleState() 456Marshal.ThrowExceptionForHR(NativeMethods.UiaElementNotAvailable); 466Marshal.ThrowExceptionForHR(NativeMethods.UiaElementNotAvailable); 470Marshal.ThrowExceptionForHR(NativeMethods.UiaElementNotEnabled);