win32

package
v0.0.0-...-0fb2adb Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	NULL  = 0
	TRUE  = 1
	FALSE = 0
)
View Source
const (
	SW_HIDE            = 0
	SW_NORMAL          = 1
	SW_SHOWMINIMIZED   = 2
	SW_SHOWMAXIMIZED   = 3
	SW_MAXIMIZE        = 3
	SW_SHOW            = 5
	SW_MINIMIZE        = 6
	SW_SHOWMINNOACTIVE = 7
	SW_RESTORE         = 9
)
View Source
const (
	CS_VREDRAW         = 0x00000001
	CS_HREDRAW         = 0x00000002
	CS_KEYCVTWINDOW    = 0x00000004
	CS_DBLCLKS         = 0x00000008
	CS_OWNDC           = 0x00000020
	CS_CLASSDC         = 0x00000040
	CS_PARENTDC        = 0x00000080
	CS_NOKEYCVT        = 0x00000100
	CS_NOCLOSE         = 0x00000200
	CS_SAVEBITS        = 0x00000800
	CS_BYTEALIGNCLIENT = 0x00001000
	CS_BYTEALIGNWINDOW = 0x00002000
	CS_GLOBALCLASS     = 0x00004000
	CS_IME             = 0x00010000
	CS_DROPSHADOW      = 0x00020000
)
View Source
const (
	HWND_TOP       = (HWND)(0)
	HWND_BOTTOM    = (HWND)(1)
	HWND_TOPMOST   = (HWND)(UINT_MAX - 1 + 1)
	HWND_NOTOPMOST = (HWND)(UINT_MAX - 2 + 1)
)
View Source
const (
	MONITOR_DEFAULTTOPRIMARY = 0x00000001
	MONITOR_DEFAULTTONEAREST = 0x00000002
)
View Source
const (
	SWP_NOSIZE        = 0x0001
	SWP_NOMOVE        = 0x0002
	SWP_NOZORDER      = 0x0004
	SWP_NOACTIVATE    = 0x0010
	SWP_FRAMECHANGED  = 0x0020
	SWP_NOOWNERZORDER = 0x0200
)
View Source
const (
	WS_VISIBLE          = 0x10000000
	WS_CAPTION          = 0x00C00000
	WS_MAXIMIZEBOX      = 0x00010000
	WS_MINIMIZEBOX      = 0x00020000
	WS_OVERLAPPED       = 0x00000000
	WS_SYSMENU          = 0x00080000
	WS_THICKFRAME       = 0x00040000
	WS_POPUP            = 0x80000000
	WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX)

	WS_EX_LAYERED = 0x00080000
)
View Source
const (
	WM_CREATE           = 0x0001
	WM_DESTROY          = 0x0002
	WM_MOVE             = 0x0003
	WM_SIZE             = 0x0005
	WM_ACTIVATE         = 0x0006
	WM_SETFOCUS         = 0x0007
	WM_KILLFOCUS        = 0x0008
	WM_PAINT            = 0x000f
	WM_CLOSE            = 0x0010
	WM_QUIT             = 0x0012
	WM_GETMINMAXINFO    = 0x0024
	WM_WINDOWPOSCHANGED = 0x0047
	WM_CHAR             = 0x0102
	WM_SYSCHAR          = 0x0106
	WM_UNICHAR          = 0x0109
	WM_COMMAND          = 0x0111
	WM_SYSCOMMAND       = 0x0112
	WM_LBUTTONDOWN      = 0x0201
	WM_RBUTTONDOWN      = 0x0204
	WM_MOVING           = 0x0216
	WM_DPICHANGED       = 0x02E0
	WM_USER             = 0x0400
)
View Source
const (
	SC_KEYMENU      = 0xF100
	SC_SCREENSAVE   = 0xF140
	SC_MONITORPOWER = 0xF170
)
View Source
const (
	NIF_MESSAGE = 0x00000001
	NIF_ICON    = 0x00000002
	NIF_TIP     = 0x00000004
	NIF_STATE   = 0x00000008
	NIF_INFO    = 0x00000010
)
View Source
const (
	NIM_ADD    = 0x00000000
	NIM_MODIFY = 0x00000001
	NIM_DELETE = 0x00000002
)
View Source
const (
	MIIM_BITMAP     = 0x00000080
	MIIM_CHECKMARKS = 0x00000008
	MIIM_DATA       = 0x00000020
	MIIM_FTYPE      = 0x00000100
	MIIM_ID         = 0x00000002
	MIIM_STATE      = 0x00000001
	MIIM_STRING     = 0x00000040
	MIIM_SUBMENU    = 0x00000004
	MIIM_TYPE       = 0x00000010

	MFT_STRING     = 0x00000000
	MFT_RADIOCHECK = 0x00000200
	MFT_SEPARATOR  = 0x00000800

	MFS_CHECKED   = 0x00000008
	MFS_DISABLED  = 0x00000003
	MFS_ENABLED   = 0x00000000
	MFS_UNCHECKED = 0x00000000

	TPM_CENTERALIGN = 0x0004
	TPM_LEFTALIGN   = 0x0000
	TPM_RIGHTALIGN  = 0x0008

	TPM_BOTTOMALIGN  = 0x0020
	TPM_TOPALIGN     = 0x0000
	TPM_VCENTERALIGN = 0x0010

	TPM_NONOTIFY  = 0x0080
	TPM_RETURNCMD = 0x0100

	TPM_LEFTBUTTON  = 0x0000
	TPM_RIGHTBUTTON = 0x0002
)
View Source
const (
	GWL_STYLE     = -16
	GWL_EXSTYLE   = -20
	GWL_USERDATA  = -21
	GWLP_USERDATA = -21
)
View Source
const (
	CF_TEXT        = 1
	CF_UNICODETEXT = 13
)
View Source
const (
	MB_OK       = 0x00000000
	MB_OKCANCEL = 0x00000001
	MB_YESNO    = 0x00000004

	MB_ICONWARNING     = 0x00000030
	MB_ICONINFORMATION = 0x00000040
	MB_ICONERROR       = 0x00000010

	IDOK = 1
)
View Source
const (
	LOGPIXELSX = 88
	LOGPIXELSY = 90
)
View Source
const (
	LWA_COLORKEY = 0x00000001
	LWA_ALPHA    = 0x00000002
)
View Source
const (
	DWM_BB_ENABLE     = 0x00000001
	DWM_BB_BLURREGION = 0x00000002
)
View Source
const CCHDEVICENAME = 32
View Source
const CCHFORMNAME = 32
View Source
const (
	COLOR_WINDOW = 5
)
View Source
const (
	CW_USEDEFAULT = ^0x7fffffff
)
View Source
const DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = (HANDLE)(UINT_MAX - 4 + 1)

https://docs.microsoft.com/en-us/windows/win32/hidpi/dpi-awareness-context

View Source
const (
	DWMWA_CLOAKED = 14
)
View Source
const ENUM_CURRENT_SETTINGS = 0xFFFFFFFF
View Source
const (
	GMEM_MOVEABLE = 0x0002
)
View Source
const (
	IDC_ARROW = 32512
)
View Source
const INT_MAX = ^int(0)
View Source
const LONG_MAX = 2147483647
View Source
const (
	PM_REMOVE = 0x0001
)
View Source
const PROCESS_PER_MONITOR_DPI_AWARE = 2
View Source
const UINT_MAX = ^uint(0)
View Source
const USER_DEFAULT_SCREEN_DPI = 96
View Source
const Win32TrayIconMessage = (WM_USER + 1)

Variables

This section is empty.

Functions

func AdjustWindowRect

func AdjustWindowRect(rect *RECT, style DWORD, bMenu BOOL) bool

func AppendSubmenu

func AppendSubmenu(submenu HMENU, mii *MENUITEMINFO)

func DeleteObject

func DeleteObject(obj HANDLE) bool

func DestroyMenu

func DestroyMenu(menu HMENU) bool

func DestroyWindow

func DestroyWindow(hwnd HWND) bool

func DispatchMessage

func DispatchMessage(msg *MSG)

func DwmEnableBlurBehindWindow

func DwmEnableBlurBehindWindow(hwnd HWND, pBlurBehind *DWM_BLURBEHIND) bool

func DwmGetWindowAttribute

func DwmGetWindowAttribute(hwnd HWND, dwAttribute DWORD, pvAttribute unsafe.Pointer, cbAttribute DWORD) bool

func EndPaint

func EndPaint(hwnd HWND, lpPaintstruct *PAINTSTRUCT) bool

func EnumDisplayMonitors

func EnumDisplayMonitors(hdc HDC, clip *RECT, enumProc MONITORENUMPROC, data LPARAM) bool

func EnumDisplaySettings

func EnumDisplaySettings(deviceName *uint16, iModeNum DWORD, lpDevMode *DEVMODE) bool

func ExitProcess

func ExitProcess(exitCode UINT)

func FillRgn

func FillRgn(hdc HDC, hrgn HRGN, hbr HBRUSH) bool

func GetClientRect

func GetClientRect(hwnd HWND, lpRect *RECT) bool

func GetCursorPos

func GetCursorPos(pos *POINT) bool

func GetDeviceCaps

func GetDeviceCaps(hdc HDC, index int) int

func GetDpiForMonitor

func GetDpiForMonitor(monitor HMONITOR, dpiType uint32, dpiX *UINT, dpiY *UINT) bool

func GetMenuItemCount

func GetMenuItemCount(menu HMENU) int32

func GetMessage

func GetMessage(msg *MSG, hwnd HWND, msgFilterMin uint32, msgFilterMax uint32) bool

func GetMonitorInfoW

func GetMonitorInfoW(monitor HMONITOR, info *MONITORINFOEX) bool

func GetSystemPowerStatus

func GetSystemPowerStatus(powerStatus *SYSTEM_POWER_STATUS) bool

func GetWindowLongPtrW

func GetWindowLongPtrW(hwnd HWND, index int) uintptr

func GetWindowPlacement

func GetWindowPlacement(hwnd HWND, lpwndpl *WINDOWPLACEMENT) bool

func GetWindowRect

func GetWindowRect(hwnd HWND, lpRect *RECT) bool

func HIWORD

func HIWORD(dw uint32) uint16

func InsertMenuItemW

func InsertMenuItemW(menu HMENU, item UINT, byPosition int32, itemInfo *MENUITEMINFO) bool

func InvalidateRect

func InvalidateRect(hwnd HWND, rect *RECT, erase BOOL) bool

func IsIconic

func IsIconic(hwnd HWND) bool

func IsWindowCloaked

func IsWindowCloaked(hwnd HWND) bool

func IsWindowVisible

func IsWindowVisible(hwnd HWND) bool

func LOWORD

func LOWORD(dw uint32) uint16

func LookupIconIdFromDirectoryEx

func LookupIconIdFromDirectoryEx(bytes *BYTE, icon BOOL, cxDesired int32, cyDesired int32, flags UINT) int32

func MakeIntResource

func MakeIntResource(id uint16) *uint16

func MessageBox

func MessageBox(hwnd HWND, text string, caption string, flags UINT) int32

func NewTrayMenu

func NewTrayMenu(menu HMENU, icon []byte, callback func(id int32)) bool

func OS_GetClipboardText

func OS_GetClipboardText() string

func OS_Init

func OS_Init()

func OS_SetClipboardText

func OS_SetClipboardText(text string) bool

func PeekMessageW

func PeekMessageW(msg *MSG, hwnd HWND, msgFilterMin uint32, msgFilterMax uint32, removeMsg uint32) bool

func PollEvents

func PollEvents()

func PostQuitMessage

func PostQuitMessage(exitCode int32)

func RegisterClassExW

func RegisterClassExW(wcx *WNDCLASSEXW) (uint16, error)

func RegisterWindowClass

func RegisterWindowClass(className string, instance HINSTANCE, callback WNDPROC, style UINT, icon HICON) bool

func ReleaseDC

func ReleaseDC(hwnd HWND, hdc HDC) int32

func RemoveAllTrayMenus

func RemoveAllTrayMenus()

func SetForegroundWindow

func SetForegroundWindow(hwnd HWND) bool

func SetLayeredWindowAttributes

func SetLayeredWindowAttributes(hwnd HWND, crKey DWORD, bAlpha byte, dwFlags DWORD) bool

func SetMenu

func SetMenu(hwnd HWND, hmenu HMENU) bool

func SetProcessDPIAware

func SetProcessDPIAware() bool

func SetProcessDpiAwareness

func SetProcessDpiAwareness(awareness int32) bool

func SetProcessDpiAwarenessContext

func SetProcessDpiAwarenessContext(context HANDLE) bool

func SetWindowLongPtrW

func SetWindowLongPtrW(hwnd HWND, index int, dwNewLong unsafe.Pointer) uintptr

func SetWindowPlacement

func SetWindowPlacement(hwnd HWND, lpwndpl *WINDOWPLACEMENT) bool

func SetWindowPos

func SetWindowPos(hwnd HWND, hwndInsertAfter HWND, x int, y int, cx int, cy int, flags UINT) bool

func SetWindowTextW

func SetWindowTextW(hwnd HWND, title string) bool

func Shell_NotifyIconW

func Shell_NotifyIconW(dwMessage DWORD, nid *NOTIFYICONDATA) bool

func ShowWindow

func ShowWindow(hwnd HWND, nCmdShow int) bool

func TrackPopupMenu

func TrackPopupMenu(menu HMENU, flags UINT, x int32, y int32, nReserved int32, hwnd HWND, rect *RECT) int32

func TranslateMessage

func TranslateMessage(msg *MSG)

func UpdateWindow

func UpdateWindow(hwnd HWND) bool

func Utf16PtrToString

func Utf16PtrToString(p uintptr) string

func ValidateRect

func ValidateRect(hwnd HWND, lpRect *RECT) bool

Types

type ATOM

type ATOM uint16

type BOOL

type BOOL int32

type BYTE

type BYTE uint8

type CHAR

type CHAR uint8

type COLORREF

type COLORREF DWORD

type DEVMODE

type DEVMODE struct {
	DmDeviceName    [CCHDEVICENAME]uint16
	DmSpecVersion   WORD
	DmDriverVersion WORD
	DmSize          WORD
	DmDriverExtra   WORD
	DmFields        DWORD

	// union!
	DmPosition POINT // 64 bytes

	DmColor            int16
	DmDuplex           int16
	DmYResolution      int16
	DmTTOption         int16
	DmCollate          int16
	DmFormName         [CCHFORMNAME]WCHAR
	DmLogPixels        WORD
	DmBitsPerPel       DWORD
	DmPelsWidth        DWORD
	DmPelsHeight       DWORD
	DmDisplayFlags     DWORD
	DmDisplayFrequency DWORD
	DmICMMethod        DWORD
	DmICMIntent        DWORD
	DmMediaType        DWORD
	DmDitherType       DWORD
	DmReserved1        DWORD
	DmReserved2        DWORD
	DmPanningWidth     DWORD
	DmPanningHeight    DWORD
	// contains filtered or unexported fields
}

http://msdn.microsoft.com/en-us/library/windows/desktop/dd183565.aspx

type DWM_BLURBEHIND

type DWM_BLURBEHIND struct {
	DwFlags                DWORD
	FEnable                BOOL
	HRgnBlur               HRGN
	FTransitionOnMaximized BOOL
}

type DWORD

type DWORD uint32

func GetLastError

func GetLastError() DWORD

type GUID

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

type HANDLE

type HANDLE uintptr

type HBITMAP

type HBITMAP HANDLE

type HBRUSH

type HBRUSH HANDLE

func CreateSolidBrush

func CreateSolidBrush(color COLORREF) HBRUSH

type HCURSOR

type HCURSOR HICON

func LoadCursorResource

func LoadCursorResource(cursorName uint32) (HCURSOR, error)

type HDC

type HDC HANDLE

func BeginPaint

func BeginPaint(hwnd HWND, lpPaintstruct *PAINTSTRUCT) HDC

func GetDC

func GetDC(hwnd HWND) HDC

type HICON

type HICON HANDLE

func CreateIconFromBytes

func CreateIconFromBytes(icon []byte) HICON

func CreateIconFromResourceEx

func CreateIconFromResourceEx(bytes *BYTE, size DWORD, icon BOOL, ver DWORD, cxDesired int32, cyDesired int32, flags UINT) HICON

type HINSTANCE

type HINSTANCE HANDLE

func GetModuleHandle

func GetModuleHandle() HINSTANCE

type HMENU

type HMENU HANDLE

func CreateMenu

func CreateMenu() HMENU

func CreatePopupMenu

func CreatePopupMenu() HMENU

type HMODULE

type HMODULE HANDLE

type HMONITOR

type HMONITOR HANDLE

func MonitorFromWindow

func MonitorFromWindow(hwnd HWND, dwFlags DWORD) HMONITOR

type HRGN

type HRGN HANDLE

func CreateRectRgn

func CreateRectRgn(x1 int, y1 int, x2 int, y2 int) HRGN

func CreateRectRgnIndirect

func CreateRectRgnIndirect(lprect *RECT) HRGN

type HWND

type HWND HANDLE

func CreateWindowExW

func CreateWindowExW(dwExStyle DWORD, className string, windowName string, style DWORD, x, y, width, height int32, parent, menu, instance HINSTANCE, lpParam uintptr) HWND

func GetActiveWindow

func GetActiveWindow() HWND

func GetForegroundWindow

func GetForegroundWindow() HWND

func SetFocus

func SetFocus(hwnd HWND) HWND

type LARGE_INTEGER

type LARGE_INTEGER struct {
	LowPart  DWORD
	HighPart DWORD
}

type LONG

type LONG int32

func GetWindowLongW

func GetWindowLongW(hwnd HWND, index int) LONG

func SetWindowLongW

func SetWindowLongW(hwnd HWND, index int, long LONG) LONG

type LONG_PTR

type LONG_PTR uintptr

type LPARAM

type LPARAM LONG_PTR

type LPCWSTR

type LPCWSTR *uint16

type LPWSTR

type LPWSTR *uint16

type LRESULT

type LRESULT LONG_PTR

func DefWindowProc

func DefWindowProc(hwnd HWND, msg uint32, wparam WPARAM, lparam LPARAM) LRESULT
type MENUITEMINFO MENUITEMINFOW

func MakeMenuItem

func MakeMenuItem(id int, label string, disabled bool, checked bool, isRadio bool) MENUITEMINFO

func MakeMenuItemSeparator

func MakeMenuItemSeparator() MENUITEMINFO
type MENUITEMINFOW struct {
	CbSize        UINT
	FMask         UINT
	FType         UINT
	FState        UINT
	WID           UINT
	HSubMenu      HMENU
	HbmpChecked   HBITMAP
	HbmpUnchecked HBITMAP
	DwItemData    ULONG_PTR
	DwTypeData    LPWSTR
	Cch           UINT
	HbmpItem      HBITMAP
}

type MINMAXINFO

type MINMAXINFO struct {
	PtReserved     POINT
	PtMaxSize      POINT
	PtMaxPosition  POINT
	PtMinTrackSize POINT
	PtMaxTrackSize POINT
}

type MONITORENUMPROC

type MONITORENUMPROC func(unnamedParam1 HMONITOR, unnamedParam2 HDC, unnamedParam3 *RECT, unnamedParam4 LPARAM) uintptr

type MONITORINFO

type MONITORINFO struct {
	CbSize    DWORD
	RcMonitor RECT
	RcWork    RECT
	DwFlags   DWORD
}

type MONITORINFOEX

type MONITORINFOEX MONITORINFOEXW

func (*MONITORINFOEX) GetDeviceName

func (info *MONITORINFOEX) GetDeviceName() string

type MONITORINFOEXW

type MONITORINFOEXW struct {
	MONITORINFO
	DeviceName [CCHDEVICENAME]uint16
}

type MSG

type MSG struct {
	Hwnd     HWND
	Message  UINT
	WParam   WPARAM
	LParam   LPARAM
	Time     DWORD
	Pt       POINT
	LPrivate DWORD
}

https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-msg

type NOTIFYICONDATA

type NOTIFYICONDATA NOTIFYICONDATAW

type NOTIFYICONDATAW

type NOTIFYICONDATAW struct {
	CbSize           DWORD
	HWnd             HWND
	UID              UINT
	UFlags           UINT
	UCallbackMessage UINT
	HIcon            HICON
	SzTip            [128]WCHAR // @Incomplete: according to the docs, sometimes this is 64 instead?
	DwState          DWORD
	DwStateMask      DWORD
	SzInfo           [256]WCHAR
	UTimeout         UINT
	UVersion         UINT
	SzInfoTitle      [64]WCHAR
	DwInfoFlags      DWORD
	GuidItem         GUID
	HBalloonIcon     HICON
}

https://docs.microsoft.com/en-us/windows/win32/api/shellapi/ns-shellapi-notifyicondataa

type PAINTSTRUCT

type PAINTSTRUCT struct {
	Hdc         HDC
	FErase      BOOL
	RcPaint     RECT
	FRestore    BOOL
	FIncUpdate  BOOL
	RgbReserved [32]BYTE
}

type SIZE

type SIZE struct {
	Cx LONG
	Cy LONG
}

type SYSTEM_POWER_STATUS

type SYSTEM_POWER_STATUS struct {
	ACLineStatus        BYTE
	BatteryFlag         BYTE
	BatteryLifePercent  BYTE
	SystemStatusFlag    BYTE
	BatteryLifeTime     DWORD
	BatteryFullLifeTime DWORD
}

type UINT

type UINT uint32

func TimeBeginPeriod

func TimeBeginPeriod(uPeriod UINT) UINT

type UINT_PTR

type UINT_PTR uintptr

type ULONG_PTR

type ULONG_PTR uintptr

type WCHAR

type WCHAR uint16

type WINDOWPLACEMENT

type WINDOWPLACEMENT struct {
	Length           UINT
	Flags            UINT
	ShowCmd          UINT
	PtMinPosition    POINT
	PtMaxPosition    POINT
	RcNormalPosition RECT
	RcDevice         RECT
}

type WNDCLASSEXW

type WNDCLASSEXW struct {
	CbSize        UINT
	Style         UINT
	LpfnWndProc   uintptr // OR WNDPROC?
	CbClsExtra    int32
	CbWndExtra    int32
	HInstance     HINSTANCE
	HIcon         HICON
	HCursor       HCURSOR
	HbrBackground HBRUSH
	LpszMenuName  LPCWSTR
	LpszClassName LPCWSTR
	LIconSm       HICON
}

https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassexw

type WNDPROC

type WNDPROC func(hwnd HWND, msg uint32, wparam WPARAM, lparam LPARAM) LRESULT

type WORD

type WORD uint16

type WPARAM

type WPARAM UINT_PTR

type Win32_Tray

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

Jump to

Keyboard shortcuts

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