gui

package
v0.0.0-...-1cfdf4e Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KERNEL32_ADDR       = 0
	USER32_ADDR         = 100
	COMDLG32_ADDR       = 200
	SHELL32_ADDR        = 300
	OLE32_ADDR          = 400
	GDI32_ADDR          = 500
	ALIAS_ADDR          = 600
	KERNEL32_ALIAS_ADDR = ALIAS_ADDR
	USER32_ALIAS_ADDR   = KERNEL32_ALIAS_ADDR + 10
	COMDLG32_ALIAS_ADDR = USER32_ALIAS_ADDR + 20
	SHELL32_ALIAS_ADDR  = COMDLG32_ALIAS_ADDR + 10

	WS_BORDER       = 0x00800000
	WS_CAPTION      = 0x00C00000
	WS_CHILD        = 0x40000000
	WS_CHILDWINDOW  = 0x40000000
	WS_CLIPCHILDREN = 0x02000000
	WS_CLIPSIBLINGS = 0x04000000
	WS_DISABLED     = 0x08000000
	WS_DLGFRAME     = 0x00400000
	WS_GROUP        = 0x00020000
	WS_HSCROLL      = 0x00100000
	WS_ICONIC       = 0x20000000
	WS_MAXIMIZE     = 0x01000000
	WS_MAXIMIZEBOX  = 0x00010000
	WS_MINIMIZE     = 0x20000000
	WS_MINIMIZEBOX  = 0x00020000
	WS_OVERLAPPED   = 0x00000000
	WS_POPUP        = 0x80000000
	WS_SIZEBOX      = 0x00040000
	WS_SYSMENU      = 0x00080000
	WS_TABSTOP      = 0x00010000
	WS_THICKFRAME   = 0x00040000
	WS_TILED        = 0x00000000
	WS_VISIBLE      = 0x10000000
	WS_VSCROLL      = 0x00200000

	WS_POPUPWINDOW      = WS_POPUP | WS_BORDER | WS_SYSMENU
	WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX
	WS_TILEDWINDOW      = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX

	WS_EX_DLGMODALFRAME  = 0x00001
	WS_EX_DRAGOBJECT     = 0x00002
	WS_EX_NOPARENTNOTIFY = 0x00004
	WS_EX_TOPMOST        = 0x00008
	WS_EX_ACCEPTFILES    = 0x00010
	WS_EX_TRANSPARENT    = 0x00020
	WS_EX_MDICHILD       = 0x00040
	WS_EX_TOOLWINDOW     = 0x00080
	WS_EX_WINDOWEDGE     = 0x00100
	WS_EX_CLIENTEDGE     = 0x00200
	WS_EX_CONTEXTHELP    = 0x00400
	WS_EX_RIGHT          = 0x01000
	WS_EX_LEFT           = 0x00000
	WS_EX_RTLREADING     = 0x02000
	WS_EX_LTRREADING     = 0x00000
	WS_EX_LEFTSCROLLBAR  = 0x04000
	WS_EX_RIGHTSCROLLBAR = 0x00000
	WS_EX_CONTROLPARENT  = 0x10000
	WS_EX_STATICEDGE     = 0x20000
	WS_EX_APPWINDOW      = 0x40000
	WS_EX_LAYERED        = 0x80000

	WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE
	WS_EX_PALETTEWINDOW    = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST

	CP_UTF8 = 65001

	IDC_ARROW = 0x7f00

	SS_LEFT      = 0x00000000
	SS_CENTER    = 0x00000001
	SS_ICON      = 0x00000003
	SS_SIMPLE    = 0x00000011
	SS_OWNERDRAW = 0x0000000d

	BS_PUSHBUTTON      = 0x00000000
	BS_DEFPUSHBUTTON   = 0x00000001
	BS_CHECKBOX        = 0x00000002
	BS_AUTOCHECKBOX    = 0x00000003
	BS_RADIOBUTTON     = 0x00000004
	BS_3STATE          = 0x00000005
	BS_AUTO3STATE      = 0x00000006
	BS_GROUPBOX        = 0x00000007
	BS_AUTORADIOBUTTON = 0x00000009
	BS_OWNERDRAW       = 0x0000000b
	BS_RIGHTTEXT       = 0x00000020
	BS_RIGHTBUTTON     = 0x00000020
	BS_ICON            = 0x00000040
	BS_BITMAP          = 0x00000080
	BS_LEFT            = 0x00000100
	BS_RIGHT           = 0x00000200
	BS_CENTER          = 0x00000300
	BS_FLAT            = 0x00008000

	ES_LEFT        = 0x0000
	ES_CENTER      = 0x0001
	ES_RIGHT       = 0x0002
	ES_MULTILINE   = 0x0004
	ES_UPPERCASE   = 0x0008
	ES_LOWERCASE   = 0x0010
	ES_PASSWORD    = 0x0020
	ES_AUTOVSCROLL = 0x0040
	ES_AUTOHSCROLL = 0x0080
	ES_NOHIDESEL   = 0x0100
	ES_OEMCONVERT  = 0x0400
	ES_READONLY    = 0x0800
	ES_WANTRETURN  = 0x1000
	ES_NUMBER      = 0x2000

	COLOR_MENU    = 0x4
	COLOR_WINDOW  = 0x5
	COLOR_BTNFACE = 0xf

	WM_CREATE         = 0x0001
	WM_DESTROY        = 0x0002
	WM_SIZE           = 0x0005
	WM_SETFOCUS       = 0x0007
	WM_PAINT          = 0x000f
	WM_CLOSE          = 0x0010
	WM_ERASEBKGND     = 0x0014
	WM_COMMAND        = 0x0111
	WM_CTLCOLORSTATIC = 0x0138

	SM_CXSCREEN = 0
	SM_CYSCREEN = 1

	OFN_READONLY         = 0x00001
	OFN_OVERWRITEPROMPT  = 0x00002
	OFN_HIDEREADONLY     = 0x00004
	OFN_NOCHANGEDIR      = 0x00008
	OFN_ENABLEHOOK       = 0x00020
	OFN_ENABLETEMPLATE   = 0x00040
	OFN_NOVALIDATE       = 0x00100
	OFN_ALLOWMULTISELECT = 0x00200
	OFN_PATHMUSTEXIST    = 0x00800
	OFN_FILEMUSTEXIST    = 0x01000
	OFN_CREATEPROMPT     = 0x02000
	OFN_SHAREAWARE       = 0x04000
	OFN_NOREADONLYRETURN = 0x08000
	OFN_NOTESTFILECREATE = 0x10000
	OFN_NONETWORKBUTTON  = 0x20000
	OFN_NOLONGNAMES      = 0x40000

	BIF_RETURNONLYFSDIRS  = 0x0001
	BIF_DONTGOBELOWCURDIR = 0x0002
	BIF_STATUSTEXT        = 0x0004
	BIF_RETURNFSANCESTORS = 0x0008
	BIF_EDITBOX           = 0x0010
	BIF_VALIDATE          = 0x0020
	BIF_NEWDIALOGSTYLE    = 0x0040
	BIF_USENEWUI          = BIF_EDITBOX | BIF_NEWDIALOGSTYLE
	BIF_NONEWFOLDERBUTTON = 0x0200
	BIF_BROWSEFORCOMPUTER = 0x1000
	BIF_BROWSEFORPRINTER  = 0x2000
	BIF_UAHEX             = 0x4000

	PROGRESS_CLASS = "msctls_progress32"

	PBM_SETRANGE = 0x0401
	PBM_SETPOS   = 0x0402
	PBM_SETSTEP  = 0x0404
	PBM_STEPIT   = 0x0405

	MB_OK                   = 0x000000
	MB_OKCANCEL             = 0x000001
	MB_ABORTRETRYIGNORE     = 0x000002
	MB_YESNOCANCEL          = 0x000003
	MB_YESNO                = 0x000004
	MB_RETRYCANCEL          = 0x000005
	MB_ICONHAND             = 0x000010
	MB_ICONQUESTION         = 0x000020
	MB_ICONEXCLAMATION      = 0x000030
	MB_ICONASTERISK         = 0x000040
	MB_USERICON             = 0x000080
	MB_ICONWARNING          = MB_ICONEXCLAMATION
	MB_ICONERROR            = MB_ICONHAND
	MB_ICONINFORMATION      = MB_ICONASTERISK
	MB_ICONSTOP             = MB_ICONHAND
	MB_DEFBUTTON1           = 0x000000
	MB_DEFBUTTON2           = 0x000100
	MB_DEFBUTTON3           = 0x000200
	MB_DEFBUTTON4           = 0x000300
	MB_APPLMODAL            = 0x000000
	MB_SYSTEMMODAL          = 0x001000
	MB_TASKMODAL            = 0x002000
	MB_HELP                 = 0x004000
	MB_NOFOCUS              = 0x008000
	MB_SETFOREGROUND        = 0x010000
	MB_DEFAULT_DESKTOP_ONLY = 0x020000
	MB_TOPMOST              = 0x040000
	MB_RIGHT                = 0x080000
	MB_RTLREADING           = 0x100000
	MB_SERVICE_NOTIFICATION = 0x200000

	CW_USEDEFAULT = 0x80000000
	MAX_PATH      = 260
)

Variables

View Source
var (
	Kernel32 *syscall.LazyDLL
	User32   *syscall.LazyDLL
	Comctl32 *syscall.LazyDLL
	Comdlg32 *syscall.LazyDLL
	Shell32  *syscall.LazyDLL
	Ole32    *syscall.LazyDLL
	Gdi32    *syscall.LazyDLL
)

Functions

func AttachThreadInput

func AttachThreadInput(args ...uintptr) uintptr

func BeginPaint

func BeginPaint(args ...uintptr) uintptr

func CStr

func CStr(str string) (ret uintptr)

Utility aliases

func CoTaskMemFree

func CoTaskMemFree(args ...uintptr) uintptr

func CreateSolidBrush

func CreateSolidBrush(args ...uintptr) uintptr

func CreateWindow

func CreateWindow(proc func(hwnd syscall.Handle, msg uint32, wparam, lparam uintptr) uintptr, hbr syscall.Handle, windowNamePtr uintptr, style, left, top, right, bottom uintptr)

Function to create a window, either ANSI or Wide character support

func CreateWindowEx

func CreateWindowEx(args ...uintptr) uintptr

func CreateWindowExA

func CreateWindowExA(args ...uintptr) uintptr

func CreateWindowExW

func CreateWindowExW(args ...uintptr) uintptr

func DefWindowProc

func DefWindowProc(args ...uintptr) uintptr

func DefWindowProcA

func DefWindowProcA(args ...uintptr) uintptr

func DefWindowProcW

func DefWindowProcW(args ...uintptr) uintptr

func DeleteObject

func DeleteObject(args ...uintptr) uintptr

func DestroyWindow

func DestroyWindow(args ...uintptr) uintptr

func DispatchMessage

func DispatchMessage(args ...uintptr) uintptr

func DispatchMessageA

func DispatchMessageA(args ...uintptr) uintptr

func DispatchMessageW

func DispatchMessageW(args ...uintptr) uintptr

func EnableAnsi

func EnableAnsi(ansiBool bool)

Function to switch between ANSI and wide character support

func EnableWindow

func EnableWindow(args ...uintptr) uintptr

func EndPaint

func EndPaint(args ...uintptr) uintptr

func FillRect

func FillRect(args ...uintptr) uintptr

func GetCurrentThreadId

func GetCurrentThreadId(args ...uintptr) uintptr

func GetDlgItem

func GetDlgItem(args ...uintptr) uintptr

func GetMessage

func GetMessage(args ...uintptr) uintptr

func GetMessageA

func GetMessageA(args ...uintptr) uintptr

func GetMessageW

func GetMessageW(args ...uintptr) uintptr

func GetModuleHandle

func GetModuleHandle(args ...uintptr) uintptr

func GetModuleHandleA

func GetModuleHandleA(args ...uintptr) uintptr

func GetModuleHandleW

func GetModuleHandleW(args ...uintptr) uintptr

func GetOpenFileName

func GetOpenFileName(args ...uintptr) uintptr

func GetOpenFileNameA

func GetOpenFileNameA(args ...uintptr) uintptr

func GetOpenFileNameW

func GetOpenFileNameW(args ...uintptr) uintptr

func GetSaveFileName

func GetSaveFileName(args ...uintptr) uintptr

func GetSaveFileNameA

func GetSaveFileNameA(args ...uintptr) uintptr

func GetSaveFileNameW

func GetSaveFileNameW(args ...uintptr) uintptr

func GetStockObject

func GetStockObject(args ...uintptr) uintptr

func GetSystemMetrics

func GetSystemMetrics(args ...uintptr) uintptr

func GetWindowText

func GetWindowText(args ...uintptr) uintptr

func GetWindowTextA

func GetWindowTextA(args ...uintptr) uintptr

func GetWindowTextLength

func GetWindowTextLength(args ...uintptr) uintptr

func GetWindowTextLengthA

func GetWindowTextLengthA(args ...uintptr) uintptr

func GetWindowTextLengthW

func GetWindowTextLengthW(args ...uintptr) uintptr

func GetWindowTextW

func GetWindowTextW(args ...uintptr) uintptr

func GetWindowThreadProcessId

func GetWindowThreadProcessId(args ...uintptr) uintptr

func Init_aliases

func Init_aliases()

Function to assign aliases to foreign function addresses based on current environment

func InvalidateRect

func InvalidateRect(args ...uintptr) uintptr

func IsAnsi

func IsAnsi() bool

Function to return if the current environment is ANSI

func IsWindowEnabled

func IsWindowEnabled(args ...uintptr) uintptr

func LoadCursor

func LoadCursor(args ...uintptr) uintptr

func LoadCursorA

func LoadCursorA(args ...uintptr) uintptr

func LoadCursorW

func LoadCursorW(args ...uintptr) uintptr

func MessageBox

func MessageBox(args ...uintptr) uintptr

func MessageBoxA

func MessageBoxA(args ...uintptr) uintptr

func MessageBoxW

func MessageBoxW(args ...uintptr) uintptr

func MultiByteToWideChar

func MultiByteToWideChar(args ...uintptr) uintptr

func PostMessage

func PostMessage(args ...uintptr) uintptr

func PostMessageA

func PostMessageA(args ...uintptr) uintptr

func PostMessageW

func PostMessageW(args ...uintptr) uintptr

func PostQuitMessage

func PostQuitMessage(args ...uintptr) uintptr

func PostThreadMessage

func PostThreadMessage(args ...uintptr) uintptr

func PostThreadMessageA

func PostThreadMessageA(args ...uintptr) uintptr

func PostThreadMessageW

func PostThreadMessageW(args ...uintptr) uintptr

func RegisterClass

func RegisterClass(args ...uintptr) uintptr

func RegisterClassA

func RegisterClassA(args ...uintptr) uintptr

func RegisterClassW

func RegisterClassW(args ...uintptr) uintptr

func SHBrowseForFolder

func SHBrowseForFolder(args ...uintptr) uintptr

func SHBrowseForFolderA

func SHBrowseForFolderA(args ...uintptr) uintptr

func SHBrowseForFolderW

func SHBrowseForFolderW(args ...uintptr) uintptr

func SHGetPathFromIDList

func SHGetPathFromIDList(args ...uintptr) uintptr

func SHGetPathFromIDListA

func SHGetPathFromIDListA(args ...uintptr) uintptr

func SHGetPathFromIDListW

func SHGetPathFromIDListW(args ...uintptr) uintptr

func SHSimpleIDListFromPath

func SHSimpleIDListFromPath(args ...uintptr) uintptr

func SendMessage

func SendMessage(args ...uintptr) uintptr

func SendMessageA

func SendMessageA(args ...uintptr) uintptr

func SendMessageW

func SendMessageW(args ...uintptr) uintptr

func SetBkMode

func SetBkMode(args ...uintptr) uintptr

func SetFocus

func SetFocus(args ...uintptr) uintptr

func SetForegroundWindow

func SetForegroundWindow(args ...uintptr) uintptr

func SetTextColor

func SetTextColor(args ...uintptr) uintptr

func SetWindowText

func SetWindowText(args ...uintptr) uintptr

func SetWindowTextA

func SetWindowTextA(args ...uintptr) uintptr

func SetWindowTextW

func SetWindowTextW(args ...uintptr) uintptr

func ShowWindow

func ShowWindow(args ...uintptr) uintptr

func TranslateMessage

func TranslateMessage(args ...uintptr) uintptr

func UnregisterClass

func UnregisterClass(args ...uintptr) uintptr

func UnregisterClassA

func UnregisterClassA(args ...uintptr) uintptr

func UnregisterClassW

func UnregisterClassW(args ...uintptr) uintptr

func UpdateWindow

func UpdateWindow(args ...uintptr) uintptr

func WideCharToMultiByte

func WideCharToMultiByte(args ...uintptr) uintptr

Types

type BROWSEINFOA

type BROWSEINFOA struct {
	HwndOwner      syscall.Handle
	PidlRoot       uintptr
	PszDisplayName *byte
	LpszTitle      *byte
	UlFlags        uint32
	Lpfn           uintptr
	LParam         uintptr
	IImage         int32
}

type BROWSEINFOW

type BROWSEINFOW struct {
	HwndOwner      syscall.Handle
	PidlRoot       uintptr
	PszDisplayName *uint16
	LpszTitle      *uint16
	UlFlags        uint32
	Lpfn           uintptr
	LParam         uintptr
	IImage         int32
}

type MSG

type MSG struct {
	Hwnd    syscall.Handle
	Message uint32
	WParam  uintptr
	LParam  uintptr
	Time    uint32
	Pt      POINT
}

type OPENFILENAMEA

type OPENFILENAMEA struct {
	LStructSize       uint32
	HwndOwner         syscall.Handle
	HInstance         syscall.Handle
	LpstrFilter       *byte
	LpstrCustomFilter *byte
	NMaxCustFilter    uint32
	NFilterIndex      uint32
	LpstrFile         *byte
	NMaxFile          uint32
	LpstrFileTitle    *byte
	NMaxFileTitle     uint32
	LpstrInitialDir   *byte
	LpstrTitle        *byte
	Flags             uint32
	NFileOffset       uint16
	NFileExtension    uint16
	LpstrDefExt       *byte
	LCustData         uintptr
	LpfnHook          uintptr
	LpTemplateName    *byte
	PvReserved        unsafe.Pointer
	DwReserved        uint32
	FlagsEx           uint32
}

type OPENFILENAMEW

type OPENFILENAMEW struct {
	LStructSize       uint32
	HwndOwner         syscall.Handle
	HInstance         syscall.Handle
	LpstrFilter       *uint16
	LpstrCustomFilter *uint16
	NMaxCustFilter    uint32
	NFilterIndex      uint32
	LpstrFile         *uint16
	NMaxFile          uint32
	LpstrFileTitle    *uint16
	NMaxFileTitle     uint32
	LpstrInitialDir   *uint16
	LpstrTitle        *uint16
	Flags             uint32
	NFileOffset       uint16
	NFileExtension    uint16
	LpstrDefExt       *uint16
	LCustData         uintptr
	LpfnHook          uintptr
	LpTemplateName    *uint16
	PvReserved        unsafe.Pointer
	DwReserved        uint32
	FlagsEx           uint32
}

type PAINTSTRUCT

type PAINTSTRUCT struct {
	Hdc        syscall.Handle
	FErase     int32
	RcPaint    RECT
	FRestore   int32
	FIncUpdate int32
}

type POINT

type POINT struct {
	X int32
	Y int32
}

type RECT

type RECT struct {
	Left   int32
	Top    int32
	Right  int32
	Bottom int32
}

type WNDCLASSA

type WNDCLASSA struct {
	Style         uint32
	LpfnWndProc   uintptr
	CbClsExtra    int32
	CbWndExtra    int32
	HInstance     syscall.Handle
	HIcon         syscall.Handle
	HCursor       syscall.Handle
	HbrBackground syscall.Handle
	LpszMenuName  *byte
	LpszClassName *byte
}

type WNDCLASSW

type WNDCLASSW struct {
	Style         uint32
	LpfnWndProc   uintptr
	CbClsExtra    int32
	CbWndExtra    int32
	HInstance     syscall.Handle
	HIcon         syscall.Handle
	HCursor       syscall.Handle
	HbrBackground syscall.Handle
	LpszMenuName  *uint16
	LpszClassName *uint16
}

Jump to

Keyboard shortcuts

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