windows

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 33 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Rendered for windows/amd64

Overview

Package windows implements the MyGo backend for Windows: Win32 windows hosting WebView2, called through the syscall package (no cgo).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestAccessibilityPerform added in v0.2.0

func TestAccessibilityPerform(hwnd uintptr, label, action, value string) bool

TestAccessibilityPerform acts on the element labeled label as UI Automation's clients do: "press", "increment", "decrement", "focus", or "value" to set its text to value. It reports whether the element can.

func TestActivateAccelerator added in v0.1.10

func TestActivateAccelerator(hwnd uintptr, acc string) bool

TestActivateAccelerator runs the menu item of a window's shortcut, as its keys do in the page, and reports whether there is one.

func TestActivateMenuItem

func TestActivateMenuItem(hwnd uintptr, path ...string) error

TestActivateMenuItem activates an item of a window's menu bar, found by the labels along its path, e.g. TestActivateMenuItem(hwnd, "File", "New").

func TestCaptionButtons added in v0.1.11

func TestCaptionButtons(hwnd uintptr) []string

TestCaptionButtons returns the window controls of a window with a hidden title bar, left to right, named after what WM_NCHITTEST answers over their middles, which Windows' snap layouts rely on.

func TestCaptionColor added in v0.2.8

func TestCaptionColor(hwnd uintptr, name string) (r, g, b uint8, ok bool)

TestCaptionColor puts the pointer over a window control of a hidden title bar, "minimize", "maximize" or "close", as far as the control knows, and returns the color on the screen beside its glyph once Windows has composed it: what the user sees, through UpdateLayeredWindow or DirectComposition. The pointer leaves after.

func TestChoosePopupItem added in v0.2.0

func TestChoosePopupItem(label string) bool

TestChoosePopupItem chooses the item labeled label of a popup menu the main thread shows, with the keys a keyboard presses in it, and reports whether there is one.

func TestClickSurface added in v0.2.0

func TestClickSurface(hwnd uintptr, x, y float64) bool

TestClickSurface clicks (x, y), in DIPs, in a window showing native UI, with the messages a mouse sends. It reports false for a window showing a web page.

func TestComposeOver added in v0.2.0

func TestComposeOver(hwnd uintptr, text string, caret int, commit bool, from, length int) bool

TestComposeOver does what an input method that converts typed text again does: unless from is -1, it settles the reconversion of length runes from rune from of the text around the caret; then it composes text with the caret at caret, or commits it.

func TestComposed added in v0.2.8

func TestComposed(hwnd uintptr) (noRedirect, composed bool)

TestComposed reports whether a window has no redirection bitmap, for the material behind its page, and whether the controls of its hidden title bar show through the DirectComposition device in use.

func TestDocumentFeed added in v0.2.0

func TestDocumentFeed(hwnd uintptr) (text string, start, length int, ok bool)

TestDocumentFeed returns the text around the caret that input methods get from a window showing native UI with IMR_DOCUMENTFEED, and the selection in it, in runes.

func TestDragSurface added in v0.2.5

func TestDragSurface(hwnd uintptr, points [][2]float64) bool

TestDragSurface presses the primary button at the first of points, in DIPs, in a window showing native UI, moves the pointer through the others, and releases it at the last, with the messages a mouse sends.

func TestDropData added in v0.2.17

func TestDropData(hwnd uintptr, x, y float64, d transfer.Data, ops transfer.Operation) (operation transfer.Operation, dropped bool)

TestDropData uses the production IDataObject and OLE destination with no process-local token, exercising serialized data and delayed rendering.

func TestDropFiles added in v0.2.0

func TestDropFiles(hwnd uintptr, x, y float64, paths []string) (over, dropped bool)

TestDropFiles drags files from Explorer to (x, y), in DIPs, of a window showing native UI and drops them there, through its drop target, and reports whether the content took them over there and when dropped.

func TestEndMenu added in v0.1.10

func TestEndMenu()

TestEndMenu leaves the menus, as Escape does.

func TestEnterMenuBar added in v0.1.10

func TestEnterMenuBar(hwnd uintptr) bool

TestEnterMenuBar takes the keyboard to a window's menu bar, as Alt and F10 do, and returns once it leaves the menus. It reports false when the window cannot come to the front, which the keyboard needs.

func TestFailWebViews added in v0.2.15

func TestFailWebViews(n int)

TestFailWebViews makes the next n creations of webviews fail, as WebView2 reports a failure, when it would have created them; 0 lets them be.

func TestForeground added in v0.2.3

func TestForeground(hwnd uintptr) bool

TestForeground brings a window to the front, where the keyboard types, and reports whether it came.

func TestLoseComposition added in v0.2.8

func TestLoseComposition(removed bool) bool

TestLoseComposition takes the DirectComposition device away, as a draw that finds it invalid does, or, with removed, signals that its GPU device was removed. It reports false without a device, or, with removed, without the event (Windows 10 before 1607).

func TestMenuBarShown added in v0.1.10

func TestMenuBarShown(hwnd uintptr) bool

TestMenuBarShown reports whether a window shows its menu bar.

func TestPopups added in v0.2.0

func TestPopups() [][]string

TestPopups returns the labels of the items of the popup menus the main thread shows, "-" for separators.

func TestPressCaptionButton added in v0.1.11

func TestPressCaptionButton(hwnd uintptr, name string) bool

TestPressCaptionButton clicks a window control of a window with a hidden title bar: "minimize", "maximize" or "close".

func TestPressKeys

func TestPressKeys(keys ...byte)

TestPressKeys presses virtual keys together and releases them, like a keyboard would.

func TestRightClickSurface added in v0.2.0

func TestRightClickSurface(hwnd uintptr, x, y float64) bool

TestRightClickSurface clicks (x, y), in DIPs, in a window showing native UI with the secondary button, as TestClickSurface does with the primary.

func TestSetDroppedFiles

func TestSetDroppedFiles(hwnd uintptr, paths []string)

TestSetDroppedFiles makes paths the files of the next drop on a window's page, as if they had been dragged there.

func TestSideButton added in v0.2.5

func TestSideButton(hwnd uintptr, back bool) bool

TestSideButton clicks a mouse's back or forward button (XBUTTON1 and XBUTTON2) in a window showing native UI, with the messages a mouse sends.

func TestTopNonClient added in v0.1.12

func TestTopNonClient(hwnd uintptr) (px, want int32)

TestTopNonClient returns how many pixels at the top of a window are not its client area, and how many a hidden title bar keeps there on this version of Windows: one on Windows 11, none on Windows 10.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend is the Windows (Win32 + WebView2) implementation of platform.Backend.

func New

func New() *Backend

New creates the Windows backend.

func (*Backend) App

func (b *Backend) App() platform.AppController

func (*Backend) Clipboard

func (b *Backend) Clipboard() platform.Clipboard

func (*Backend) Dialogs

func (b *Backend) Dialogs() platform.Dialogs

func (*Backend) Init

func (*Backend) IsMainThread

func (b *Backend) IsMainThread() bool

func (*Backend) Name

func (b *Backend) Name() string

func (*Backend) NewTray

func (b *Backend) NewTray(h platform.TrayHandler) (platform.Tray, error)

func (*Backend) NewWindow

func (*Backend) NotificationsSupported

func (b *Backend) NotificationsSupported() bool

func (*Backend) PopupMenu

func (b *Backend) PopupMenu(m *platform.Menu, pw platform.Window, pos *platform.Point)

func (*Backend) Power

func (b *Backend) Power() platform.Power

func (*Backend) Quit

func (b *Backend) Quit()

Quit ends the event loop. Modal loops (dialogs, menus) end too: they forward WM_QUIT to the loop they run in.

func (*Backend) RegisterHotkey

func (b *Backend) RegisterHotkey(id int, acc string) error

func (*Backend) RemoveAllNotifications added in v0.2.15

func (b *Backend) RemoveAllNotifications()

func (*Backend) RemoveNotification

func (b *Backend) RemoveNotification(id string)

func (*Backend) Run

func (b *Backend) Run() error

func (*Backend) Screen

func (b *Backend) Screen() platform.Screen

func (*Backend) SetApplicationMenu

func (b *Backend) SetApplicationMenu(m *platform.Menu)

func (*Backend) Shell

func (b *Backend) Shell() platform.Shell

func (*Backend) ShowNotification

func (b *Backend) ShowNotification(n *platform.Notification, done func(error))

func (*Backend) Signal

func (b *Backend) Signal()

func (*Backend) Step

func (b *Backend) Step()

func (*Backend) Theme

func (b *Backend) Theme() platform.Theme

func (*Backend) UnregisterHotkey

func (b *Backend) UnregisterHotkey(id int)

func (*Backend) UpdateMenuItem

func (b *Backend) UpdateMenuItem(it *platform.MenuItem)

func (*Backend) Wake

func (b *Backend) Wake()

type GUID

type GUID struct {
	Data1 uint32
	Data2 uint16
	Data3 uint16
	Data4 [8]byte
}

GUID is a COM interface or class identifier.

type TestAccessNode added in v0.2.0

type TestAccessNode struct {
	Role, Label, Value string
	// contains filtered or unexported fields
}

TestAccessNode is an element of native UI as UI Automation reads it: the name of its control type, its name, and its value.

func TestAccessibility added in v0.2.0

func TestAccessibility(hwnd uintptr) ([]TestAccessNode, bool)

TestAccessibility reads the elements of a window showing native UI as UI Automation's clients do, in order, and reports false when it cannot.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL