win

package
v0.0.0-...-8faa606 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2023 License: MIT Imports: 16 Imported by: 3

README

Windigo / win

This package contains the bindings to the Win32 API functions and structs.

Most files are named following this pattern:

subject_windowslib.go

Where:

  • subject can be a handle, like HWND, or a group of features, like functions or structs;

  • windowslib is the native Win32 library where the bindings are coming from, like user32.dll or uxtheme.dll libraries.

The names of structs and functions are the same found in the Win32 API.

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

View Source
var Path _PathT

File and folder path utilities.

View Source
var Str _StrT

String utilities, including wide char UTF-16 string conversion functions.

Functions

func AdjustWindowRectEx

func AdjustWindowRectEx(rc *RECT, style co.WS, hasMenu bool, exStyle co.WS_EX)

AdjustWindowRectEx function.

func AllocConsole

func AllocConsole() error

AllocConsole function.

⚠️ You must defer FreeConsole().

func AllowSetForegroundWindow

func AllowSetForegroundWindow(processId uint32)

AllowSetForegroundWindow function.

func AttachConsole

func AttachConsole(processId uint32) error

AttachConsole function.

⚠️ You must defer FreeConsole().

func BroadcastSystemMessage

func BroadcastSystemMessage(
	flags co.BSF,
	recipients co.BSM,
	msg co.WM,
	wParam WPARAM,
	lParam LPARAM) (broadcastSuccessful bool, receivers co.BSM, e error)

BroadcastSystemMessage function.

func ChooseColor

func ChooseColor(cc *CHOOSECOLOR) bool

ChooseColor function.

func CommDlgExtendedError

func CommDlgExtendedError() errco.CDERR

CommDlgExtendedError function.

func CommandLineToArgv

func CommandLineToArgv(cmdLine string) []string

CommandLineToArgv function.

Typically used with GetCommandLine().

func CopyFile

func CopyFile(existingFile, newFile string, failIfExists bool) error

CopyFile function.

func CreateDirectory

func CreateDirectory(
	pathName string, securityAttributes *SECURITY_ATTRIBUTES) error

CreateDirectory function.

func CreateProcess

func CreateProcess(
	applicationName, commandLine StrOpt,
	processAttributes, threadAttributes *SECURITY_ATTRIBUTES,
	inheritHandles bool,
	creationFlags co.CREATE,
	environment []struct {
		name string
		val  string
	},
	currentDirectory StrOpt,
	startupInfo *STARTUPINFO,
	processInformation *PROCESS_INFORMATION)

CreateProcess function.

⚠️ You must defer HPROCESS.CloseHandle() and HTHREAD.CloseHandle() on HProcess and HThread members of PROCESS_INFORMATION.

func DeleteFile

func DeleteFile(fileName string) error

DeleteFile function.

func DestroyCaret

func DestroyCaret() error

DestroyCaret function.

func DispatchMessage

func DispatchMessage(msg *MSG) uintptr

DispatchMessage function.

func DwmEnableMMCSS

func DwmEnableMMCSS(enable bool) error

DwmEnableMMCSS function.

func DwmFlush

func DwmFlush() error

DwmFlush function.

func DwmIsCompositionEnabled

func DwmIsCompositionEnabled() bool

DwmIsCompositionEnabled function.

func EndMenu

func EndMenu()

EndMenu function.

func EnumDisplayDevices

func EnumDisplayDevices(
	device StrOpt, flags co.EDD,
	callback func(devNum int, info *DISPLAY_DEVICE) bool)

EnumDisplayDevices function.

To continue enumeration, the callback function must return true; to stop enumeration, it must return false.

func EnumProcesses

func EnumProcesses() ([]uint32, error)

EnumProcesses function.

func EnumWindows

func EnumWindows(callback func(hWnd HWND) bool)

EnumWindows function.

To continue enumeration, the callback function must return true; to stop enumeration, it must return false.

func ExitProcess

func ExitProcess(exitCode uint32)

ExitProcess function.

func ExpandEnvironmentStrings

func ExpandEnvironmentStrings(src string) string

ExpandEnvironmentStrings function.

func FileTimeToSystemTime

func FileTimeToSystemTime(inFileTime *FILETIME, outSystemTime *SYSTEMTIME)

FileTimeToSystemTime function.

func FreeConsole

func FreeConsole() error

FreeConsole function.

func GdiFlush

func GdiFlush() bool

GdiFlush function.

func GetAsyncKeyState

func GetAsyncKeyState(virtKeyCode co.VK) uint16

GetAsyncKeyState function.

func GetCommandLine

func GetCommandLine() string

GetCommandLine function.

func GetConsoleCP

func GetConsoleCP() (co.CP, error)

GetConsoleCP function.

func GetConsoleTitle

func GetConsoleTitle() (string, error)

GetConsoleTitle function.

func GetCurrentDirectory

func GetCurrentDirectory() string

GetCurrentDirectory function.

func GetCurrentProcessId

func GetCurrentProcessId() uint32

GetCurrentProcessId function.

func GetCurrentThreadId

func GetCurrentThreadId() uint32

GetCurrentThreadId function.

func GetDialogBaseUnits

func GetDialogBaseUnits() (horz, vert uint16)

GetDialogBaseUnits function.

func GetDynamicTimeZoneInformation

func GetDynamicTimeZoneInformation(
	timeZoneInfo *DYNAMIC_TIME_ZONE_INFORMATION) co.TIME_ZONE_ID

GetDynamicTimeZoneInformation function.

func GetEnvironmentStrings

func GetEnvironmentStrings() map[string]string

GetEnvironmentStrings function.

You don't need to call FreeEnvironmentStrings, it's automatically called after the data retrieval.

func GetFileAttributes

func GetFileAttributes(fileName string) (co.FILE_ATTRIBUTE, error)

GetFileAttributes function.

func GetFileVersionInfo

func GetFileVersionInfo(fileName string) ([]byte, error)

GetFileVersionInfo function.

Automatically allocs the buffer with GetFileVersionInfoSize().

func GetFileVersionInfoSize

func GetFileVersionInfoSize(fileName string) (uint32, error)

GetFileVersionInfo function.

func GetGUIThreadInfo

func GetGUIThreadInfo(thread_id uint32, info *GUITHREADINFO)

GetGUIThreadInfo function.

func GetInputState

func GetInputState() bool

GetInputState function.

func GetLocalTime

func GetLocalTime(systemTime *SYSTEMTIME)

GetLocalTime function.

Example

var st win.SYSTEMTIME
win.GetLocalTime(&st)

func GetMessage

func GetMessage(
	msg *MSG, hWnd HWND, msgFilterMin, msgFilterMax uint32) (int32, error)

GetMessage function.

func GetMessageTime

func GetMessageTime() time.Duration

GetMessageTime function.

func GetProcessDefaultLayout

func GetProcessDefaultLayout() co.LAYOUT

GetProcessDefaultLayout function.

func GetQueueStatus

func GetQueueStatus(flags co.QS) uint32

GetQueueStatus function.

func GetStartupInfo

func GetStartupInfo(startupInfo *STARTUPINFO)

GetStartupInfo function.

func GetSystemInfo

func GetSystemInfo(systemInfo *SYSTEM_INFO)

GetSystemInfo function.

func GetSystemMetrics

func GetSystemMetrics(index co.SM) int32

GetSystemMetrics function.

func GetSystemMetricsForDpi

func GetSystemMetricsForDpi(index co.SM, dpi uint32) int32

GetSystemMetricsForDpi function.

Available in Windows 10, version 1607.

func GetSystemTime

func GetSystemTime(systemTime *SYSTEMTIME)

GetSystemTime function.

Note that the returned value is in UTC format, the local time can be retrieved with GetLocalTime.

Example

var st win.SYSTEMTIME
win.GetSystemTime(&st)

func GetTickCount64

func GetTickCount64() uint64

GetTickCount64 function.

func GetTimeZoneInformation

func GetTimeZoneInformation(
	timeZoneInfo *TIME_ZONE_INFORMATION) co.TIME_ZONE_ID

GetTimeZoneInformation function.

func GetTimeZoneInformationForYear

func GetTimeZoneInformationForYear(
	wYear uint16,
	dtzi *DYNAMIC_TIME_ZONE_INFORMATION,
	tzi *TIME_ZONE_INFORMATION)

GetTimeZoneInformationForYear function.

func GetVolumeInformation

func GetVolumeInformation(rootPathName StrOpt) (_VolumeInfo, error)

GetVolumeInformation function.

Example

nfo, err := win.GetVolumeInformation(win.StrOptSome("C:\\"))
if err != nil {
	panic(err)
}

fmt.Printf("Name: %s\n", nfo.Name)
fmt.Printf("File system name: %s\n", nfo.FileSystemName)
fmt.Printf("Max component length: %d\n", nfo.MaxComponentLength)
fmt.Printf("Serial number: 0x08%x\n", nfo.SerialNumber)

func GetWindowsDirectory

func GetWindowsDirectory() string

GetWindowsDirectory function.

func HIBYTE

func HIBYTE(val uint16) uint8

HIBYTE macro.

func HIWORD

func HIWORD(val uint32) uint16

HIWORD macro.

func InSendMessage

func InSendMessage() bool

InSendMessage function.

func InSendMessageEx

func InSendMessageEx() co.ISMEX

InSendMessageEx function.

func InitCommonControls

func InitCommonControls()

InitCommonControls function.

func InitCommonControlsEx

func InitCommonControlsEx(icce *INITCOMMONCONTROLSEX) bool

InitCommonControlsEx function.

func IsAppThemed

func IsAppThemed() bool

IsAppThemed function.

func IsCompositionActive

func IsCompositionActive() bool

IsCompositionActive function.

func IsGUIThread

func IsGUIThread(convertToGuiThread bool) (bool, error)

IsGUIThread function.

func IsThemeActive

func IsThemeActive() bool

IsThemeActive function.

func IsWindows10OrGreater

func IsWindows10OrGreater() bool

IsWindows10OrGreater function.

func IsWindows7OrGreater

func IsWindows7OrGreater() bool

IsWindows7OrGreater function.

func IsWindows8OrGreater

func IsWindows8OrGreater() bool

IsWindows8OrGreater function.

func IsWindows8Point1OrGreater

func IsWindows8Point1OrGreater() bool

IsWindows8Point1OrGreater function.

func IsWindowsVersionOrGreater

func IsWindowsVersionOrGreater(
	majorVersion, minorVersion uint32, servicePackMajor uint16) bool

IsWindowsVersionOrGreater function.

func IsWindowsVistaOrGreater

func IsWindowsVistaOrGreater() bool

IsWindowsVistaOrGreater function.

func IsWindowsXpOrGreater

func IsWindowsXpOrGreater() bool

IsWindowsXpOrGreater function.

func LOBYTE

func LOBYTE(val uint16) uint8

LOBYTE macro.

func LOWORD

func LOWORD(val uint32) uint16

LOWORD macro.

func LockSetForegroundWindow

func LockSetForegroundWindow(lockCode co.LSFW)

LockSetForegroundWindow function.

func MAKELONG

func MAKELONG(lo, hi uint16) uint32

MAKELONG macro.

func MAKEWORD

func MAKEWORD(lo, hi uint8) uint16

MAKEWORD macro.

func MoveFile

func MoveFile(existingFile, newFile string) error

MoveFile function.

func MoveFileEx

func MoveFileEx(existingFile, newFile string, flags co.MOVEFILE) error

MoveFileEx function.

func MulDiv

func MulDiv(number, numerator, denominator int32) int32

MulDiv function.

Note: You'll achieve a much better performance with ordinary Go code:

res := int32((int64(n) * int64(num)) / int64(den))

func PeekMessage

func PeekMessage(
	msg *MSG, hWnd HWND,
	msgFilterMin, msgFilterMax co.WM, removeMsg co.PM) bool

PeekMessage function.

func PostQuitMessage

func PostQuitMessage(exitCode int32)

PostQuitMessage function.

func PostThreadMessage

func PostThreadMessage(
	idThread uint32, msg co.WM, wParam WPARAM, lParam LPARAM) error

PostThreadMessage function.

func QueryPerformanceCounter

func QueryPerformanceCounter() int64

QueryPerformanceCounter function.

func QueryPerformanceFrequency

func QueryPerformanceFrequency() int64

QueryPerformanceFrequency function.

func RegisterWindowMessage

func RegisterWindowMessage(message string) (co.WM, error)

RegisterWindowMessage function.

func RemoveDirectory

func RemoveDirectory(pathName string) error

RemoveDirectory function.

func ReplaceFile

func ReplaceFile(
	replaced, replacement string,
	backup StrOpt, replaceFlags co.REPLACEFILE) error

ReplaceFile function.

func ReplyMessage

func ReplyMessage(result uintptr) bool

ReplyMessage function.

func SHGetFileInfo

func SHGetFileInfo(
	path string,
	fileAttributes co.FILE_ATTRIBUTE,
	sfi *SHFILEINFO,
	flags co.SHGFI)

SHGetFileInfo function.

Depends of CoInitializeEx().

func SetConsoleOutputCP

func SetConsoleOutputCP(codePage co.CP) error

SetConsoleOutputCP function.

func SetConsoleTitle

func SetConsoleTitle(title string) error

SetConsoleTitle function.

func SetCurrentDirectory

func SetCurrentDirectory(pathName string) error

SetCurrentDirectory function.

func SetFileAttributes

func SetFileAttributes(fileName string, attrs co.FILE_ATTRIBUTE) error

SetFileAttributes function.

func SetProcessDPIAware

func SetProcessDPIAware()

SetProcessDPIAware function.

Available in Windows Vista.

func SetProcessDefaultLayout

func SetProcessDefaultLayout(defaultLayout co.LAYOUT)

SetProcessDefaultLayout function.

func SetProcessDpiAwarenessContext

func SetProcessDpiAwarenessContext(value co.DPI_AWARE_CTX) error

SetProcessDpiAwarenessContext function.

Available in Windows 10, version 1703.

func ShellNotifyIcon

func ShellNotifyIcon(message co.NIM, data *NOTIFYICONDATA) error

ShellNotifyIcon function.

func Sleep

func Sleep(milliseconds uint32)

Sleep function.

func SystemParametersInfo

func SystemParametersInfo(
	uiAction co.SPI, uiParam uint32, pvParam unsafe.Pointer, fWinIni co.SPIF)

SystemParametersInfo function.

func SystemTimeToFileTime

func SystemTimeToFileTime(inSystemTime *SYSTEMTIME, outFileTime *FILETIME)

SystemTimeToFileTime function.

func SystemTimeToTzSpecificLocalTime

func SystemTimeToTzSpecificLocalTime(
	timeZoneInfo *TIME_ZONE_INFORMATION,
	inUniversalTime *SYSTEMTIME, outLocalTime *SYSTEMTIME)

SystemTimeToTzSpecificLocalTime function.

func TaskDialogIndirect

func TaskDialogIndirect(taskConfig *TASKDIALOGCONFIG) co.ID

TaskDialogIndirect function.

Prefer using ui.TaskDlg wrappers, which deals with the most commons cases of this function in a safer, easier way.

func TranslateMessage

func TranslateMessage(msg *MSG) bool

TranslateMessage function.

func TzSpecificLocalTimeToSystemTime

func TzSpecificLocalTimeToSystemTime(
	timeZoneInfo *TIME_ZONE_INFORMATION,
	inLocalTime *SYSTEMTIME, outUniversalTime *SYSTEMTIME)

TzSpecificLocalTimeToSystemTime function.

func UnregisterClass

func UnregisterClass(className ClassName, hInst HINSTANCE) error

UnregisterClass function.

func VerQueryValue

func VerQueryValue(
	block []byte, subBlock string) (ptr unsafe.Pointer, sz uint32, exists bool)

VerQueryValue function.

Returns a pointer to the block and its size, which varies according to the data type. Returns false if the block doesn't exist.

This function is rather tricky. Prefer using ResourceInfo.

func VerSetConditionMask

func VerSetConditionMask(
	conditionMask uint64, typeMask co.VER, condition co.VER_COND) uint64

VerSetConditionMask function.

func VerifyVersionInfo

func VerifyVersionInfo(
	ovi *OSVERSIONINFOEX, typeMask co.VER, conditionMask uint64) (bool, error)

VerifyVersionInfo function.

Types

type ACCEL

type ACCEL struct {
	FVirt co.ACCELF // Modifiers.
	Key   co.VK     // Virtual key code.
	Cmd   uint16    // LOWORD(wParam) value.
}

ACCEL struct.

type ATOM

type ATOM uint16

An atom.

func GlobalAddAtom

func GlobalAddAtom(s string) ATOM

GlobalAddAtom function.

⚠️ You must defer ATOM.GlobalDeleteAtom().

func RegisterClassEx

func RegisterClassEx(wcx *WNDCLASSEX) (ATOM, error)

RegisterClassEx function.

func (ATOM) GlobalDeleteAtom

func (atom ATOM) GlobalDeleteAtom() error

GlobalDeleteAtom function.

func (ATOM) GlobalGetAtomName

func (atom ATOM) GlobalGetAtomName() string

GlobalGetAtomName function.

type BITMAP

type BITMAP struct {
	BmWidth      int32
	BmHeight     int32
	BmWidthBytes int32
	BmPlanes     uint16
	BmBitsPixel  uint16
	BmBits       *byte
	// contains filtered or unexported fields
}

BITMAP struct.

func (*BITMAP) CalcBitmapSize

func (bm *BITMAP) CalcBitmapSize(bitCount uint16) int

type BITMAPFILEHEADER

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

BITMAPFILEHEADER struct.

⚠️ You must call SetBfType() to initialize the struct.

Example

var bfh BITMAPFILEHEADER
bfh.SetBfType()

func (*BITMAPFILEHEADER) BfOffBits

func (bfh *BITMAPFILEHEADER) BfOffBits() uint32

func (*BITMAPFILEHEADER) BfSize

func (bfh *BITMAPFILEHEADER) BfSize() uint32

func (*BITMAPFILEHEADER) Serialize

func (bfh *BITMAPFILEHEADER) Serialize() []byte

func (*BITMAPFILEHEADER) SetBfOffBits

func (bfh *BITMAPFILEHEADER) SetBfOffBits(val uint32)

func (*BITMAPFILEHEADER) SetBfSize

func (bfh *BITMAPFILEHEADER) SetBfSize(val uint32)

func (*BITMAPFILEHEADER) SetBfType

func (bfh *BITMAPFILEHEADER) SetBfType()

type BITMAPINFO

type BITMAPINFO struct {
	BmiHeader BITMAPINFOHEADER
	BmiColors [1]RGBQUAD
}

BITMAPINFO struct.

⚠️ You must call BmiHeader.SetBiSize() to initialize the struct.

type BITMAPINFOHEADER

type BITMAPINFOHEADER struct {
	BiWidth         int32
	BiHeight        int32
	BiPlanes        uint16
	BiBitCount      uint16
	BiCompression   co.BI
	BiSizeImage     uint32
	BiXPelsPerMeter int32
	BiYPelsPerMeter int32
	BiClrUsed       uint32
	BiClrImportant  uint32
	// contains filtered or unexported fields
}

BITMAPINFOHEADER struct.

⚠️ You must call SetBiSize() to initialize the struct.

Example

bih := &BITMAPINFOHEADER{}
bih.SetBiSize()

func (*BITMAPINFOHEADER) Serialize

func (bih *BITMAPINFOHEADER) Serialize() []byte

func (*BITMAPINFOHEADER) SetBiSize

func (bih *BITMAPINFOHEADER) SetBiSize()

type BLENDFUNCTION

type BLENDFUNCTION struct {
	BlendOp             byte
	BlendFlags          byte
	SourceConstantAlpha byte
	AlphaFormat         byte
}

BLENDFUNCTION struct.

type CHOOSECOLOR

type CHOOSECOLOR struct {
	HwndOwner      HWND
	HInstance      HWND
	RgbResult      COLORREF
	LpCustColors   *COLORREF // Slice must have 16 values.
	Flags          co.CC
	LCustData      uintptr // LPARAM
	LpfnHook       uintptr // LPCCHOOKPROC
	LpTemplateName *uint16
	// contains filtered or unexported fields
}

CHOOSECOLOR struct.

⚠️ You must call SetLStructSize() to initialize the struct.

Example

cc := &CHOOSECOLOR{}
cc.SetLStructSize()

func (*CHOOSECOLOR) SetLStructSize

func (cc *CHOOSECOLOR) SetLStructSize()

type COLORREF

type COLORREF uint32

COLORREF struct.

Specifies an RGB color.

func DwmGetColorizationColor

func DwmGetColorizationColor() (color COLORREF, isOpaqueBlend bool)

DwmGetColorizationColor function.

func GetSysColor

func GetSysColor(index co.COLOR) COLORREF

GetSysColor function.

func RGB

func RGB(red, green, blue uint8) COLORREF

RGB macro.

func (COLORREF) Blue

func (c COLORREF) Blue() uint8

GetBValue macro.

func (COLORREF) Green

func (c COLORREF) Green() uint8

GetGValue macro.

func (COLORREF) Red

func (c COLORREF) Red() uint8

GetRValue macro.

func (COLORREF) ToRgbquad

func (c COLORREF) ToRgbquad() RGBQUAD

Converts the COLORREF to an RGBQUAD struct.

type COMPAREITEMSTRUCT

type COMPAREITEMSTRUCT struct {
	CtlType    co.ODT_C
	CtlID      uint32
	HwndItem   HWND
	ItemID1    uint32
	ItemData1  uintptr // ULONG_PTR
	ItemID2    uint32
	ItemData2  uintptr // ULONG_PTR
	DwLocaleId uint32
}

COMPAREITEMSTRUCT struct.

type CONSOLE_CURSOR_INFO

type CONSOLE_CURSOR_INFO struct {
	DwSize uint32
	// contains filtered or unexported fields
}

CONSOLE_CURSOR_INFO struct.

func (*CONSOLE_CURSOR_INFO) BVisible

func (cc *CONSOLE_CURSOR_INFO) BVisible() bool

func (*CONSOLE_CURSOR_INFO) SetBVisible

func (cc *CONSOLE_CURSOR_INFO) SetBVisible(val bool)

type CONSOLE_FONT_INFO

type CONSOLE_FONT_INFO struct {
	NFont      uint32
	DwFontSize COORD
}

CONSOLE_FONT_INFO struct.

type CONSOLE_READCONSOLE_CONTROL

type CONSOLE_READCONSOLE_CONTROL struct {
	NInitialChars     uint32
	DwCtrlWakeupMask  uint32
	DwControlKeyState co.CKS
	// contains filtered or unexported fields
}

CONSOLE_READCONSOLE_CONTROL struct.

⚠️ You must call SetNLength() to initialize the struct.

func (*CONSOLE_READCONSOLE_CONTROL) SetNLength

func (c *CONSOLE_READCONSOLE_CONTROL) SetNLength()

type CONVCONTEXT

type CONVCONTEXT struct {
	WCountryID uint32

	DwSecurity uint32
	Qos        SECURITY_QUALITY_OF_SERVICE
	// contains filtered or unexported fields
}

CONVCONTEXT struct.

⚠️ You must call SetCb() to initialize the struct.

func (*CONVCONTEXT) DwLangId

func (cc *CONVCONTEXT) DwLangId() LANGID

func (*CONVCONTEXT) SetCb

func (cc *CONVCONTEXT) SetCb()

func (*CONVCONTEXT) SetDwLangId

func (cc *CONVCONTEXT) SetDwLangId(val LANGID)

type COORD

type COORD struct {
	X, Y int16
}

COORD struct.

type COPYDATASTRUCT

type COPYDATASTRUCT struct {
	DwData uintptr // ULONG_PTR
	CbData uint32
	LpData uintptr // PVOID
}

COPYDATASTRUCT struct.

type CREATESTRUCT

type CREATESTRUCT struct {
	LpCreateParams uintptr // LPVOID
	HInstance      HINSTANCE
	HMenu          HMENU
	HwndParent     HWND
	Cy, Cx         int32
	Y, X           int32
	Style          co.WS
	LpszName       *uint16
	LpszClass      *uint16
	ExStyle        co.WS_EX
}

CREATESTRUCT struct.

type CWPRETSTRUCT

type CWPRETSTRUCT struct {
	LResult uintptr // LRESULT
	LParam  LPARAM
	WParam  WPARAM
	Message co.WM
	Hwnd    HWND
}

CWPRETSTRUCT struct.

type ClassName

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

Variant type for a class name identifier, which can be empty, an ATOM or a string.

Example:

clsName := win.ClassNameStr("FOO")

if s, ok := clsName.Str(); ok {
	println(s)
}

func ClassNameAtom

func ClassNameAtom(atom ATOM) ClassName

Creates a new ClassName variant with an ATOM value.

func ClassNameNone

func ClassNameNone() ClassName

Creates a new ClassName variant with an empty value.

func ClassNameStr

func ClassNameStr(str string) ClassName

Creates a new ClassName variant with a string value.

func (*ClassName) Atom

func (me *ClassName) Atom() (ATOM, bool)

func (*ClassName) IsNone

func (me *ClassName) IsNone() bool

func (*ClassName) Str

func (me *ClassName) Str() (string, bool)

type CursorRes

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

Variant type for a cursor resource identifier.

Example:

curId := win.CursorResIdc(co.IDC_ARROW)

if idc, ok := curId.Idc(); ok {
	println(idc)
}

func CursorResIdc

func CursorResIdc(idc co.IDC) CursorRes

Creates a new CursorRes variant with a co.IDC value.

func CursorResInt

func CursorResInt(id int) CursorRes

Creates a new CursorRes variant with an int value.

func CursorResStr

func CursorResStr(str string) CursorRes

Creates a new CursorRes variant with a string value.

func (*CursorRes) Id

func (me *CursorRes) Id() (int, bool)

func (*CursorRes) Idc

func (me *CursorRes) Idc() (co.IDC, bool)

func (*CursorRes) Str

func (me *CursorRes) Str() (string, bool)

type DELETEITEMSTRUCT

type DELETEITEMSTRUCT struct {
	CtlType  co.ODT_C
	CtlID    uint32
	ItemID   uint32
	HwndItem HWND
	ItemData uintptr // ULONG_PTR
}

DELETEITEMSTRUCT struct.

type DISPLAY_DEVICE

type DISPLAY_DEVICE struct {
	StateFlags co.DISPLAY_DEVICE
	// contains filtered or unexported fields
}

DISPLAY_DEVICE struct.

⚠️ You must call SetCb() to initialize the struct.

func (*DISPLAY_DEVICE) DeviceName

func (dd *DISPLAY_DEVICE) DeviceName() string

func (*DISPLAY_DEVICE) DeviceString

func (dd *DISPLAY_DEVICE) DeviceString() string

func (*DISPLAY_DEVICE) SetCb

func (dd *DISPLAY_DEVICE) SetCb()

func (*DISPLAY_DEVICE) SetDeviceName

func (dd *DISPLAY_DEVICE) SetDeviceName(val string)

func (*DISPLAY_DEVICE) SetDeviceString

func (dd *DISPLAY_DEVICE) SetDeviceString(val string)

type DLGITEMTEMPLATE

type DLGITEMTEMPLATE struct {
	Style           co.WS
	DwExtendedStyle co.WS_EX
	X, Y, Cx, Cy    int16
	Id              uint16
}

DLGITEMTEMPLATE struct.

type DLGTEMPLATE

type DLGTEMPLATE struct {
	Style           co.WS
	DwExtendedStyle co.WS_EX
	Cdit            uint16
	X, Y, Cx, Cy    int16
}

DLGTEMPLATE struct.

type DRAWITEMSTRUCT

type DRAWITEMSTRUCT struct {
	CtlType    co.ODT
	CtlID      uint32
	ItemID     uint32
	ItemAction co.ODA
	ItemState  co.ODS
	HwndItem   HWND
	Hdc        HDC
	RcItem     RECT
	ItemData   uintptr // ULONG_PTR
}

DRAWITEMSTRUCT struct.

type DYNAMIC_TIME_ZONE_INFORMATION

type DYNAMIC_TIME_ZONE_INFORMATION struct {
	Bias int32

	StandardDate SYSTEMTIME
	StandardBias int32

	DaylightDate SYSTEMTIME
	DaylightBias int32
	// contains filtered or unexported fields
}

DYNAMIC_TIME_ZONE_INFORMATION struct.

func (*DYNAMIC_TIME_ZONE_INFORMATION) DaylightName

func (dtz *DYNAMIC_TIME_ZONE_INFORMATION) DaylightName() string

func (*DYNAMIC_TIME_ZONE_INFORMATION) DynamicDaylightTimeDisabled

func (dtz *DYNAMIC_TIME_ZONE_INFORMATION) DynamicDaylightTimeDisabled() bool

func (*DYNAMIC_TIME_ZONE_INFORMATION) SetDaylightName

func (dtz *DYNAMIC_TIME_ZONE_INFORMATION) SetDaylightName(val string)

func (*DYNAMIC_TIME_ZONE_INFORMATION) SetDynamicDaylightTimeDisabled

func (dtz *DYNAMIC_TIME_ZONE_INFORMATION) SetDynamicDaylightTimeDisabled(val bool)

func (*DYNAMIC_TIME_ZONE_INFORMATION) SetStandardName

func (dtz *DYNAMIC_TIME_ZONE_INFORMATION) SetStandardName(val string)

func (*DYNAMIC_TIME_ZONE_INFORMATION) SetTimeZoneKeyName

func (dtz *DYNAMIC_TIME_ZONE_INFORMATION) SetTimeZoneKeyName(val string)

func (*DYNAMIC_TIME_ZONE_INFORMATION) StandardName

func (dtz *DYNAMIC_TIME_ZONE_INFORMATION) StandardName() string

func (*DYNAMIC_TIME_ZONE_INFORMATION) TimeZoneKeyName

func (dtz *DYNAMIC_TIME_ZONE_INFORMATION) TimeZoneKeyName() string

type EDITBALLOONTIP

type EDITBALLOONTIP struct {
	PszTitle *uint16
	PszText  *uint16
	TtiIcon  co.TTI
	// contains filtered or unexported fields
}

EDITBALLOONTIP struct.

⚠️ You must call SetCbStruct() to initialize the struct.

Example:

ebt := &EDITBALLOONTIP{}
ebt.SetCbStruct()

func (*EDITBALLOONTIP) SetCbStruct

func (eb *EDITBALLOONTIP) SetCbStruct()

type FILETIME

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

FILETIME struct.

Can be converted to SYSTEMTIME with FileTimeToSystemTime function.

func GetSystemTimeAsFileTime

func GetSystemTimeAsFileTime() FILETIME

GetSystemTimeAsFileTime function.

Note that the returned value is in UTC format.

func GetSystemTimePreciseAsFileTime

func GetSystemTimePreciseAsFileTime() FILETIME

GetSystemTimePreciseAsFileTime function.

Note that the returned value is in UTC format.

func GetSystemTimes

func GetSystemTimes() (idleTime, kernelTime, userTime FILETIME)

GetSystemTimes function.

func (*FILETIME) EpochNano100

func (ft *FILETIME) EpochNano100() uint64

Returns the internal value converted to epoch in 100-nanoseconds unit.

func (*FILETIME) FromTime

func (ft *FILETIME) FromTime(val time.Time)

Replaces the internal value with the given time.Time.

func (*FILETIME) SetEpochNano100

func (ft *FILETIME) SetEpochNano100(val uint64)

Replaces the internal value with the given epoch in 100-nanoseconds unit.

func (*FILETIME) ToTime

func (ft *FILETIME) ToTime() time.Time

Returns the internal value converted to time.Time.

type File

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

High-level abstraction to HFILE, providing several operations.

Implements the following standard io interfaces:

Created with FileOpen().

func FileOpen

func FileOpen(filePath string, desiredAccess co.FILE_OPEN) (*File, error)

Opens a file with CreateFile, returning a new high-level File object.

⚠️ You must defer File.Close().

func (*File) Close

func (me *File) Close() error

Implements io.Closer.

Calls CloseHandle.

func (*File) Hfile

func (me *File) Hfile() HFILE

Returns the underlying handle.

func (*File) Read

func (me *File) Read(p []byte) (n int, err error)

Implements io.Reader.

Calls ReadFile to read the file contents from its current internal pointer up to the buffer size.

func (*File) ReadAll

func (me *File) ReadAll() ([]byte, error)

Rewinds the internal file pointer and reads all contents at once, then rewinds the pointer again.

Calls SetFilePointerEx and ReadFile

func (*File) ReadByte

func (me *File) ReadByte() (byte, error)

Implements io.ByteReader.

Calls ReadFile.

func (*File) ReadLines

func (me *File) ReadLines() ([]string, error)

Loads all the file content in memory with ReadAll(), which calls ReadFile, then parses it as text and returns the lines.

func (*File) Resize

func (me *File) Resize(numBytes int) error

Truncates or expands the file, according to the new size. Zero will empty the file. The internal file pointer will rewind.

Calls SetFilePointerEx and SetEndOfFile.

func (*File) Seek

func (me *File) Seek(offset int64, whence int) (int64, error)

Implements io.Seeker.

Moves the internal pointer with SetFilePointerEx.

func (*File) Size

func (me *File) Size() int

Retrieves the file size with GetFileSizeEx. This value is not cached.

func (*File) Write

func (me *File) Write(p []byte) (n int, err error)

Implements io.Writer.

Calls WriteFile to write a slice at current internal pointer position.

func (*File) WriteByte

func (me *File) WriteByte(c byte) error

Implements io.ByteWriter.

Calls WriteFile to write a byte at current internal pointer position.

func (*File) WriteString

func (me *File) WriteString(s string) (int, error)

Implements io.StringWriter.

Calls WriteFile to write a string at current internal pointer position.

type FileMapped

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

High-level abstraction to HFILEMAP, providing several operations.

Note that memory-mapped files may present issues in x86 architectures; if so, just use the ordinary File.

Created with FileMappedOpen().

func FileMappedOpen

func FileMappedOpen(
	filePath string, desiredAccess co.FILE_OPEN) (*FileMapped, error)

Opens a memory-mapped file, returning a new high-level FileMapped object.

Note that memory-mapped files may present issues in x86 architectures; if so, just use the ordinary FileOpen.

⚠️ You must defer FileMapped.Close().

func (*FileMapped) Close

func (me *FileMapped) Close() error

Unmaps and releases the file resource.

func (*FileMapped) HotSlice

func (me *FileMapped) HotSlice() []byte

Returns a slice to the memory-mapped bytes.

The FileMapped object must remain open while the slice is being used. If you need to close the file right away, use ReadAll() instead.

func (*FileMapped) ReadAll

func (me *FileMapped) ReadAll() []byte

Returns a new []byte with a copy of all data in the file.

func (*FileMapped) ReadChunk

func (me *FileMapped) ReadChunk(offset, length int) []byte

Returns a new []byte with a copy of data, start with offset, and with the given length.

func (*FileMapped) ReadLines

func (me *FileMapped) ReadLines() []string

Parses the file content as text and returns the lines.

func (*FileMapped) Resize

func (me *FileMapped) Resize(numBytes int) error

Truncates or expands the file, according to the new size. Zero will empty the file.

Internally, the file is unmapped, then remapped back into memory.

func (*FileMapped) Size

func (me *FileMapped) Size() int

Retrieves the file size. This value is cached.

type GUID

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

GUID struct.

Can be created with NewGuidFromClsid() or NewGuidFromIid().

func GuidFromClsid

func GuidFromClsid(clsid co.CLSID) *GUID

Returns a GUID struct from a CLSID string.

func GuidFromIid

func GuidFromIid(iid co.IID) *GUID

Returns a GUID struct from an IID string.

func (*GUID) String

func (g *GUID) String() string

Formats the GUID as a string.

type GUITHREADINFO

type GUITHREADINFO struct {
	Flags         co.GUI
	HwndActive    HWND
	HwndFocus     HWND
	HwndCapture   HWND
	HwndMenuOwner HWND
	HwndMoveSize  HWND
	HwndCaret     HWND
	RcCaret       RECT
	// contains filtered or unexported fields
}

GUITHREADINFO struct.

⚠️ You must call SetCbSize() to initialize the struct.

func (*GUITHREADINFO) SetCbSize

func (gti *GUITHREADINFO) SetCbSize()

type HACCEL

type HACCEL HANDLE

A handle to an accelerator table.

func CreateAcceleratorTable

func CreateAcceleratorTable(accelList []ACCEL) HACCEL

CreateAcceleratorTable function.

⚠️ You must defer HACCEL.DestroyAcceleratorTable().

func (HACCEL) CopyAcceleratorTable

func (hAccel HACCEL) CopyAcceleratorTable() []ACCEL

CopyAcceleratorTable function.

func (HACCEL) DestroyAcceleratorTable

func (hAccel HACCEL) DestroyAcceleratorTable() error

DestroyAcceleratorTable function.

type HACCESSTOKEN

type HACCESSTOKEN HANDLE

Handle to an access token.

func GetCurrentProcessToken

func GetCurrentProcessToken() HACCESSTOKEN

GetCurrentProcessToken function.

func GetCurrentThreadEffectiveToken

func GetCurrentThreadEffectiveToken() HACCESSTOKEN

GetCurrentThreadEffectiveToken function.

func (HACCESSTOKEN) CloseHandle

func (hToken HACCESSTOKEN) CloseHandle() error

CloseHandle function.

func (HACCESSTOKEN) GetTokenInformation

func (hToken HACCESSTOKEN) GetTokenInformation(
	infoClass co.TOKEN_INFO, pInfo unsafe.Pointer, szInfo uint32) error

GetTokenInformation function.

Example

Checking of the current process has elevated privileges:

hToken, _ := win.GetCurrentProcess().
	OpenProcessToken(co.TOKEN_QUERY)
defer hToken.CloseHandle()

var elevation win.TOKEN_ELEVATION
hToken.GetTokenInformation(
	co.TOKEN_INFO_Elevation,
	unsafe.Pointer(&elevation),
	uint32(unsafe.Sizeof(elevation)),
)

type HANDLE

type HANDLE syscall.Handle

A handle to an object. This generic handle is used throughout the whole API, with different meanings.

type HBITMAP

type HBITMAP HGDIOBJ

A handle to a bitmap.

func CreateBitmap

func CreateBitmap(width, height int32,
	numPlanes, bitCount uint32, bits *byte) HBITMAP

CreateBitmap function.

⚠️ You must defer HBITMAP.DeleteObject().

func CreateBitmapIndirect

func CreateBitmapIndirect(bmp *BITMAP) HBITMAP

CreateBitmapIndirect function.

⚠️ You must defer HBITMAP.DeleteObject().

func (HBITMAP) DeleteObject

func (hBmp HBITMAP) DeleteObject() error

DeleteObject function.

func (HBITMAP) GetObject

func (hBmp HBITMAP) GetObject(bmp *BITMAP)

GetObject function.

type HBRUSH

type HBRUSH HGDIOBJ

A handle to a brush.

func CreateBrushIndirect

func CreateBrushIndirect(lb *LOGBRUSH) HBRUSH

CreateBrushIndirect function.

⚠️ You must defer HBRUSH.DeleteObject().

func CreateHatchBrush

func CreateHatchBrush(hatch co.HS, color COLORREF) HBRUSH

CreateHatchBrush function.

⚠️ You must defer HBRUSH.DeleteObject().

func CreatePatternBrush

func CreatePatternBrush(hBmp HBITMAP) HBRUSH

CreatePatternBrush function.

⚠️ You must defer HBRUSH.DeleteObject().

func CreateSolidBrush

func CreateSolidBrush(color COLORREF) HBRUSH

CreateSolidBrush function.

⚠️ You must defer HBRUSH.DeleteObject().

func CreateSysColorBrush

func CreateSysColorBrush(sysColor co.COLOR) HBRUSH

This helper method performs the tricky conversion to create a brush from a system color, particularly used when registering a window class.

func GetSysColorBrush

func GetSysColorBrush(index co.COLOR) HBRUSH

GetSysColorBrush function.

func (HBRUSH) DeleteObject

func (hBrush HBRUSH) DeleteObject() error

DeleteObject function.

func (HBRUSH) GetObject

func (hBrush HBRUSH) GetObject(lb *LOGBRUSH)

GetObject function.

type HCLIPBOARD

type HCLIPBOARD struct{}

A handle to the clipboard. Actually this handle does not exist, it only serves the purpose of logically group the clipboard functions.

This handle is returned by HWND.OpenClipboard().

func (HCLIPBOARD) CloseClipboard

func (HCLIPBOARD) CloseClipboard()

CloseClipboard function.

func (HCLIPBOARD) CountClipboardFormats

func (HCLIPBOARD) CountClipboardFormats() int32

CountClipboardFormats function.

func (HCLIPBOARD) EmptyClipboard

func (HCLIPBOARD) EmptyClipboard()

EmptyClipboard function.

func (HCLIPBOARD) EnumClipboardFormats

func (HCLIPBOARD) EnumClipboardFormats() []co.CF

EnumClipboardFormats function.

func (HCLIPBOARD) GetClipboardSequenceNumber

func (HCLIPBOARD) GetClipboardSequenceNumber() uint32

GetClipboardSequenceNumber function.

func (HCLIPBOARD) IsClipboardFormatAvailable

func (HCLIPBOARD) IsClipboardFormatAvailable(format co.CF) bool

IsClipboardFormatAvailable function.

func (HCLIPBOARD) SetClipboardData

func (HCLIPBOARD) SetClipboardData(format co.CF, hMem HGLOBAL)

SetClipboardData function.

⚠️ hMem will be owned by the clipboard, do not call HGLOBAL.Free() anymore.

Unless you're doing something specific, prefer HCLIPBOARD.WriteBitmap() or HCLIPBOARD.WriteString().

func (HCLIPBOARD) WriteBitmap

func (hClip HCLIPBOARD) WriteBitmap(hBmp HBITMAP)

This helper method writes a bitmap to the clipboard with HCLIPBOARD.SetClipboardData().

⚠️ hBmp will be owned by the clipboard, do not call HBITMAP.DeleteObject() anymore.

func (HCLIPBOARD) WriteString

func (hClip HCLIPBOARD) WriteString(text string)

This helper method writes a string to the clipboard with HCLIPBOARD.SetClipboardData().

type HCONV

type HCONV HANDLE

DDE conversation handle.

type HCURSOR

type HCURSOR HANDLE

A handle to a cursor.

func CreateCursorFromResourceEx

func CreateCursorFromResourceEx(
	resBits []byte, fmtVersion int,
	cxDesired, cyDesired int,
	flags co.LR) (HCURSOR, error)

CreateCursorFromResourceEx function.

This function creates HCURSOR only. The HICON variation is CreateIconFromResourceEx().

⚠️ You must defer HCURSOR.DestroyCursor().

func (HCURSOR) CopyCursor

func (hCursor HCURSOR) CopyCursor() HCURSOR

CopyCursor function.

⚠️ You must defer HCURSOR.DestroyCursor().

func (HCURSOR) DestroyCursor

func (hCursor HCURSOR) DestroyCursor() error

DestroyCursor function.

func (HCURSOR) SetSystemCursor

func (hCursor HCURSOR) SetSystemCursor(id co.OCR)

SetSystemCursor function.

type HDC

type HDC HANDLE

A handle to a device context (DC).

func (HDC) AbortDoc

func (hdc HDC) AbortDoc()

AbortDoc function.

func (HDC) AbortPath

func (hdc HDC) AbortPath()

AbortPath function.

func (HDC) AlphaBlend

func (hdc HDC) AlphaBlend(
	originDest POINT,
	szDest SIZE,
	hdcSrc HDC,
	originSrc POINT,
	szSrc SIZE,
	ftn BLENDFUNCTION)

AlphaBlend function.

This method is called from the destination HDC.

func (HDC) AngleArc

func (hdc HDC) AngleArc(center POINT, r uint32, startAngle, sweepAngle float32)

AngleArc function.

func (HDC) Arc

func (hdc HDC) Arc(bound RECT, radialStart, radialEnd POINT)

Arc function.

func (HDC) ArcTo

func (hdc HDC) ArcTo(bound RECT, radialStart, radialEnd POINT)

ArcTo function.

func (HDC) BeginPath

func (hdc HDC) BeginPath()

BeginPath function.

⚠️ You must defer HDC.EndPath().

func (HDC) BitBlt

func (hdc HDC) BitBlt(
	destTopLeft POINT,
	sz SIZE,
	hdcSrc HDC,
	srcTopLeft POINT,
	rop co.ROP)

BitBlt function.

This method is called from the destination HDC.

func (HDC) CancelDC

func (hdc HDC) CancelDC()

CancelDC function.

func (HDC) Chord

func (hdc HDC) Chord(bound RECT, radialStart, radialEnd POINT)

Chord function.

func (HDC) CloseFigure

func (hdc HDC) CloseFigure()

CloseFigure function.

func (HDC) CreateCompatibleBitmap

func (hdc HDC) CreateCompatibleBitmap(cx, cy int32) HBITMAP

CreateCompatibleBitmap function.

⚠️ You must defer HBITMAP.DeleteObject().

func (HDC) CreateCompatibleDC

func (hdc HDC) CreateCompatibleDC() HDC

CreateCompatibleDC function.

⚠️ You must defer HDC.DeleteDC().

func (HDC) CreateDIBSection

func (hdc HDC) CreateDIBSection(
	bmi *BITMAPINFO,
	usage co.DIB,
	hSection HFILEMAP,
	offset uint32) (HBITMAP, *byte)

CreateDIBSection function.

⚠️ You must defer HBITMAP.DeleteObject().

func (HDC) DeleteDC

func (hdc HDC) DeleteDC()

DeleteDC function.

func (HDC) DrawIcon

func (hdc HDC) DrawIcon(x, y int32, hIcon HICON)

DrawIcon function.

func (HDC) DrawIconEx

func (hdc HDC) DrawIconEx(
	pos POINT, hIcon HICON, size SIZE, frameIndex uint32,
	hbrFlickerFree HBRUSH, diFlags co.DI)

DrawIconEx function.

func (HDC) Ellipse

func (hdc HDC) Ellipse(bound RECT)

Ellipse function.

func (HDC) EndPath

func (hdc HDC) EndPath()

EndPath function.

func (HDC) EnumDisplayMonitors

func (hdc HDC) EnumDisplayMonitors(
	rcClip *RECT,
	callback func(hMon HMONITOR, hdcMon HDC, rcMon *RECT) bool) error

EnumDisplayMonitors function.

To continue enumeration, the callback function must return true; to stop enumeration, it must return false.

func (HDC) FillPath

func (hdc HDC) FillPath()

FillPath function.

func (HDC) FillRect

func (hdc HDC) FillRect(rc *RECT, hBrush HBRUSH)

FillRect function.

func (HDC) FillRgn

func (hdc HDC) FillRgn(hRgn HRGN, hBrush HBRUSH)

FillRgn function.

func (HDC) FlattenPath

func (hdc HDC) FlattenPath()

FlattenPath function.

func (HDC) FrameRect

func (hdc HDC) FrameRect(rc *RECT, hBrush HBRUSH)

FrameRect function.

func (HDC) FrameRgn

func (hdc HDC) FrameRgn(hRgn HRGN, hBrush HBRUSH, w, h int32)

FrameRgn function.

func (HDC) GetCurrentPositionEx

func (hdc HDC) GetCurrentPositionEx() POINT

GetCurrentPositionEx function.

func (HDC) GetDCBrushColor

func (hdc HDC) GetDCBrushColor() COLORREF

GetDCBrushColor function.

func (HDC) GetDCPenColor

func (hdc HDC) GetDCPenColor() COLORREF

GetDCPenColor function.

func (HDC) GetDIBits

func (hdc HDC) GetDIBits(
	hbm HBITMAP,
	firstScanLine, numScanLines int,
	bitmapDataBuffer []byte,
	bmi *BITMAPINFO,
	usage co.DIB) int

GetDIBits function.

Note that this method fails if bitmapDataBuffer is an ordinary Go slice; it must be allocated directly from the OS heap.

Example

Taking a screenshot and saving into a BMP file:

cxScreen := win.GetSystemMetrics(co.SM_CXSCREEN)
cyScreen := win.GetSystemMetrics(co.SM_CYSCREEN)

hdcScreen := win.HWND(0).GetDC()
defer win.HWND(0).ReleaseDC(hdcScreen)

hBmp := hdcScreen.CreateCompatibleBitmap(cxScreen, cyScreen)
defer hBmp.DeleteObject()

hdcMem := hdcScreen.CreateCompatibleDC()
defer hdcMem.DeleteDC()

hBmpOld := hdcMem.SelectObjectBitmap(hBmp)
defer hdcMem.SelectObjectBitmap(hBmpOld)

hdcMem.BitBlt(
	win.POINT{X: 0, Y: 0},
	win.SIZE{Cx: cxScreen, Cy: cyScreen},
	hdcScreen,
	win.POINT{X: 0, Y: 0},
	co.ROP_SRCCOPY,
)

bi := win.BITMAPINFO{
	BmiHeader: win.BITMAPINFOHEADER{
		BiWidth:       cxScreen,
		BiHeight:      cyScreen,
		BiPlanes:      1,
		BiBitCount:    32,
		BiCompression: co.BI_RGB,
	},
}
bi.BmiHeader.SetBiSize()

var bmpObj win.BITMAP
hBmp.GetObject(&bmpObj)
bmpSize := bmpObj.CalcBitmapSize(bi.BmiHeader.BiBitCount)

rawMem := win.GlobalAlloc(co.GMEM_FIXED|co.GMEM_ZEROINIT, bmpSize)
defer rawMem.GlobalFree()

bmpSlice := rawMem.GlobalLock(bmpSize)
defer rawMem.GlobalUnlock()

hdcScreen.GetDIBits(hBmp, 0, int(cyScreen), bmpSlice, &bi, co.DIB_RGB_COLORS)

var bfh win.BITMAPFILEHEADER
bfh.SetBfType()
bfh.SetBfOffBits(uint32(unsafe.Sizeof(bfh) + unsafe.Sizeof(bi.BmiHeader)))
bfh.SetBfSize(bfh.BfOffBits() + uint32(bmpSize))

fo, _ := win.FileOpen("C:\\Temp\\foo.bmp", co.FILE_OPEN_RW_OPEN_OR_CREATE)
defer fo.Close()

fo.Write(bfh.Serialize())
fo.Write(bi.BmiHeader.Serialize())
fo.Write(bmpSlice)

func (HDC) GetDeviceCaps

func (hdc HDC) GetDeviceCaps(index co.GDC) int32

GetDeviceCaps function.

func (HDC) GetPolyFillMode

func (hdc HDC) GetPolyFillMode() co.POLYF

GetPolyFillMode function.

func (HDC) GetTextExtentPoint32

func (hdc HDC) GetTextExtentPoint32(text string) SIZE

GetTextExtentPoint32 function.

func (HDC) GetTextFace

func (hdc HDC) GetTextFace() string

GetTextFace function.

func (HDC) GetTextMetrics

func (hdc HDC) GetTextMetrics(tm *TEXTMETRIC)

GetTextMetrics function.

func (HDC) GetViewportExtEx

func (hdc HDC) GetViewportExtEx() SIZE

GetViewportExtEx function.

func (HDC) GetViewportOrgEx

func (hdc HDC) GetViewportOrgEx() POINT

GetViewportOrgEx function.

func (HDC) GetWindowExtEx

func (hdc HDC) GetWindowExtEx() SIZE

GetWindowExtEx function.

func (HDC) GetWindowOrgEx

func (hdc HDC) GetWindowOrgEx() POINT

GetWindowOrgEx function.

func (HDC) HiMetricToPixel

func (hdc HDC) HiMetricToPixel(
	himetricX, himetricY int32) (pixelX, pixelY int32)

AtlHiMetricToPixel function. Converts HIMETRIC units to pixels.

func (HDC) IntersectClipRect

func (hdc HDC) IntersectClipRect(coords RECT) co.REGION

IntersectClipRect function.

func (HDC) InvertRect

func (hdc HDC) InvertRect(rc *RECT)

InvertRect function.

func (HDC) InvertRgn

func (hdc HDC) InvertRgn(hRgn HRGN)

InvertRgn function.

func (HDC) LPtoDP

func (hdc HDC) LPtoDP(pts []POINT)

LPtoDP function.

func (HDC) LineTo

func (hdc HDC) LineTo(x, y int32)

LineTo function.

func (HDC) MaskBlt

func (hdc HDC) MaskBlt(
	destTopLeft POINT,
	sz SIZE,
	hdcSrc HDC,
	srcTopLeft POINT,
	hbmMask HBITMAP,
	maskOffset POINT,
	rop co.ROP)

MaskBlt function.

func (HDC) MoveToEx

func (hdc HDC) MoveToEx(x, y int32, pt *POINT)

MoveToEx function.

func (HDC) PaintDesktop

func (hdc HDC) PaintDesktop()

PaintDesktop function.

func (HDC) PaintRgn

func (hdc HDC) PaintRgn(hRgn HRGN)

PaintRgn function.

func (HDC) PathToRegion

func (hdc HDC) PathToRegion() HRGN

PathToRegion function.

⚠️ You must defer HRGN.DeleteObject().

func (HDC) Pie

func (hdc HDC) Pie(bound RECT, endPointRadial1, endPointRadial2 POINT)

Pie function.

func (HDC) PixelToHiMetric

func (hdc HDC) PixelToHiMetric(
	pixelX, pixelY int32) (himetricX, himetricY int32)

AtlPixelToHiMetric function. Converts pixels to HIMETRIC units.

func (HDC) PolyDraw

func (hdc HDC) PolyDraw(pts []POINT, usage []co.PT)

PolyDraw function.

func (HDC) PolyPolygon

func (hdc HDC) PolyPolygon(pts [][]POINT)

PolyPolygon function.

func (HDC) PolyPolyline

func (hdc HDC) PolyPolyline(pts [][]POINT)

PolyPolyline function.

func (HDC) Polygon

func (hdc HDC) Polygon(pts []POINT)

Polygon function.

func (HDC) Polyline

func (hdc HDC) Polyline(pts []POINT)

Polyline function.

func (HDC) PolylineTo

func (hdc HDC) PolylineTo(pts []POINT)

PolylineTo function.

func (HDC) PtVisible

func (hdc HDC) PtVisible(x, y int32) bool

PtVisible function.

func (HDC) Rectangle

func (hdc HDC) Rectangle(bound RECT)

Rectangle function.

func (HDC) RestoreDC

func (hdc HDC) RestoreDC(savedDC int32)

RestoreDC function.

Used together with HDC.SaveDC().

func (HDC) RoundRect

func (hdc HDC) RoundRect(bound RECT, sz SIZE)

RoundRect function.

func (HDC) SaveDC

func (hdc HDC) SaveDC() int32

SaveDC function.

Used together with HDC.RestoreDC().

func (HDC) SelectClipPath

func (hdc HDC) SelectClipPath(mode co.RGN)

SelectClipPath function.

func (HDC) SelectClipRgn

func (hdc HDC) SelectClipRgn(hRgn HRGN) co.REGION

SelectClipRgn function.

func (HDC) SelectObjectBitmap

func (hdc HDC) SelectObjectBitmap(hBmp HBITMAP) HBITMAP

SelectObjectBitmap function.

func (HDC) SelectObjectBrush

func (hdc HDC) SelectObjectBrush(hBrush HBRUSH) HBRUSH

SelectObjectBrush function.

func (HDC) SelectObjectFont

func (hdc HDC) SelectObjectFont(hFont HFONT) HFONT

SelectObjectFont function.

func (HDC) SelectObjectPen

func (hdc HDC) SelectObjectPen(hPen HPEN) HPEN

SelectObjectPen function.

func (HDC) SelectObjectRgn

func (hdc HDC) SelectObjectRgn(hRgn HRGN) co.REGION

SelectObjectRgn function.

func (HDC) SetArcDirection

func (hdc HDC) SetArcDirection(direction co.AD) co.AD

SetArcDirection function.

func (HDC) SetBkColor

func (hdc HDC) SetBkColor(color COLORREF) COLORREF

SetBkColor function.

func (HDC) SetBkMode

func (hdc HDC) SetBkMode(mode co.BKMODE) co.BKMODE

SetBkMode function.

func (HDC) SetPolyFillMode

func (hdc HDC) SetPolyFillMode(mode co.POLYF) co.POLYF

SetPolyFillMode function.

func (HDC) SetStretchBltMode

func (hdc HDC) SetStretchBltMode(mode co.STRETCH) co.STRETCH

SetStretchBltMode function.

func (HDC) SetTextAlign

func (hdc HDC) SetTextAlign(align co.TA)

SetTextAlign function.

func (HDC) StretchBlt

func (hdc HDC) StretchBlt(
	destTopLeft POINT, destSz SIZE,
	hdcSrc HDC, srcTopLeft POINT, srcSz SIZE, rop co.ROP)

StretchBlt function.

This method is called from the destination HDC.

func (HDC) StrokeAndFillPath

func (hdc HDC) StrokeAndFillPath()

StrokeAndFillPath function.

func (HDC) StrokePath

func (hdc HDC) StrokePath()

StrokePath function.

func (HDC) TextOut

func (hdc HDC) TextOut(x, y int32, text string)

TextOut function.

func (HDC) TransparentBlt

func (hdc HDC) TransparentBlt(
	destTopLeft POINT,
	destSz SIZE,
	hdcSrc HDC,
	srcTopLeft POINT,
	srcSz SIZE,
	colorTransparent COLORREF)

TransparentBlt function.

This method is called from the destination HDC.

func (HDC) WidenPath

func (hdc HDC) WidenPath()

WidenPath function.

type HDDE

type HDDE uint32

A handle to a DDE instance. Actually this handle does not exist, it's just a number identifying the instance.

This handle is returned by win.DdeInitialize().

func DdeInitialize

func DdeInitialize(
	callback func(
		wType co.XTYP,
		wFmt uint32,
		hConv HCONV,
		hsz1, hsz2 HSZ,
		hData, dwData1, dwData2 uintptr) uintptr,
	afCmd co.AFCMD) (HDDE, error)

DdeInitialize function.

Note that this function is intended to be called only once. If you call it more than once, you'll overwrite the callback function.

⚠️ You must defer HDDE.DdeUninitialize().

func (HDDE) DdeAddData

func (hDde HDDE) DdeAddData(
	hData HDDEDATA,
	data []byte,
	offset int) (HDDEDATA, error)

DdeAddData function.

⚠️ You must defer HDDE.DdeFreeDataHandle().

func (HDDE) DdeClientTransaction

func (hDde HDDE) DdeClientTransaction(
	data []byte,
	hConv HCONV,
	item StrOpt,
	fmt co.CF,
	xType co.XTYP,
	msTimeout int) (HDDEDATA, error)

DdeClientTransaction function.

For an async operation, pass -1 to timeout.

⚠️ You must defer HDDE.DdeFreeDataHandle().

func (HDDE) DdeCmpStringHandles

func (hDde HDDE) DdeCmpStringHandles(hsz1, hsz2 HSZ) int

DdeCmpStringHandles function.

func (HDDE) DdeConnect

func (hDde HDDE) DdeConnect(
	serviceName,
	topic StrOpt,
	cc *CONVCONTEXT) (HCONV, error)

DdeConnect function.

⚠️ You must defer HDDE.DdeDisconnect().

func (HDDE) DdeCreateStringHandle

func (hDde HDDE) DdeCreateStringHandle(text string) (HSZ, error)

DdeCreateStringHandle function.

⚠️ You must defer HDDE.DdeFreeStringHandle().

func (HDDE) DdeDisconnect

func (hDde HDDE) DdeDisconnect(hConv HCONV) error

DdeDisconnect function.

func (HDDE) DdeFreeDataHandle

func (hDde HDDE) DdeFreeDataHandle(hData HDDEDATA) error

DdeFreeDataHandle function.

func (HDDE) DdeFreeStringHandle

func (hDde HDDE) DdeFreeStringHandle(hsz HSZ) error

DdeFreeStringHandle function.

func (HDDE) DdeGetData

func (hDde HDDE) DdeGetData(hData HDDEDATA, offset int) ([]byte, error)

DdeGetData function.

The buffer size is automatically determined.

func (HDDE) DdeGetLastError

func (hDde HDDE) DdeGetLastError() errco.DMLERR

DdeGetLastError function.

func (HDDE) DdeKeepStringHandle

func (hDde HDDE) DdeKeepStringHandle(hsz HSZ) error

DdeKeepStringHandle function.

⚠️ You must defer HDDE.DdeFreeStringHandle() on the hsz, because a clone of it has been made.

func (HDDE) DdeNameService

func (hDde HDDE) DdeNameService(serviceName StrOpt, opts co.DDENS) error

DdeNameService function.

func (HDDE) DdePostAdvise

func (hDde HDDE) DdePostAdvise(topic, item StrOpt) error

DdePostAdvise function.

func (HDDE) DdeQueryString

func (hDde HDDE) DdeQueryString(hsz HSZ) (string, error)

DdeQueryString function.

func (HDDE) DdeUninitialize

func (hDde HDDE) DdeUninitialize() error

DdeUninitialize function.

type HDDEDATA

type HDDEDATA HANDLE

DDE data handle.

type HDROP

type HDROP HANDLE

A handle to an internal drop structure.

func (HDROP) DragFinish

func (hDrop HDROP) DragFinish()

DragFinish function.

This function is rather tricky. Prefer using HDROP.ListFilesAndFinish().

func (HDROP) DragQueryFile

func (hDrop HDROP) DragQueryFile(
	iFile uint32,
	lpszFile *uint16,
	cch uint32) uint32

DragQueryFile function.

This function is rather tricky. Prefer using HDROP.ListFilesAndFinish().

func (HDROP) DragQueryPoint

func (hDrop HDROP) DragQueryPoint() (POINT, bool)

DragQueryPoint function.

Returns true if dropped within client area.

func (HDROP) ListFilesAndFinish

func (hDrop HDROP) ListFilesAndFinish() []string

This helper method retrieves all file names with DragQueryFile() and calls DragFinish().

type HDWP

type HDWP HANDLE

A handle to a deferred window position structure.

func BeginDeferWindowPos

func BeginDeferWindowPos(numWindows int32) HDWP

BeginDeferWindowPos function.

⚠️ You must defer HDWP.EndDeferWindowPos().

func (HDWP) DeferWindowPos

func (hDwp HDWP) DeferWindowPos(
	hWnd, hwndInsertAfter HWND,
	x, y, cx, cy int32,
	uFlags co.SWP) HDWP

DeferWindowPos function.

func (HDWP) EndDeferWindowPos

func (hDwp HDWP) EndDeferWindowPos() error

EndDeferWindowPos function.

type HELPINFO

type HELPINFO struct {
	IContextType co.HELPINFO
	ICtrlId      int32
	HItemHandle  HANDLE
	DwContextId  uintptr // DWORD_PTR
	MousePos     POINT
	// contains filtered or unexported fields
}

HELPINFO struct.

⚠️ You must call SetCbSize() to initialize the struct.

func (*HELPINFO) SetCbSize

func (hi *HELPINFO) SetCbSize()

type HEVENT

type HEVENT HANDLE

A handle to an event.

type HFILE

type HFILE HANDLE

A handle to a file.

func CreateFile

func CreateFile(
	fileName string,
	desiredAccess co.GENERIC,
	shareMode co.FILE_SHARE,
	securityAttributes *SECURITY_ATTRIBUTES,
	creationDisposition co.DISPOSITION,
	attributes co.FILE_ATTRIBUTE,
	flags co.FILE_FLAG,
	security co.SECURITY,
	hTemplateFile HFILE) (HFILE, error)

CreateFile function.

⚠️ You must defer HFILE.CloseHandle().

func (HFILE) CloseHandle

func (hFile HFILE) CloseHandle() error

CloseHandle function.

func (HFILE) CreateFileMapping

func (hFile HFILE) CreateFileMapping(
	securityAttributes *SECURITY_ATTRIBUTES,
	protectPage co.PAGE,
	protectSec co.SEC,
	maxSize uint64,
	objectName StrOpt) (HFILEMAP, error)

CreateFileMapping function.

⚠️ You must defer HFILEMAP.CloseHandle().

func (HFILE) GetFileSizeEx

func (hFile HFILE) GetFileSizeEx() (uint64, error)

GetFileSizeEx function.

func (HFILE) LockFile

func (hFile HFILE) LockFile(offset, numBytes uint64) error

LockFile function.

⚠️ You must defer HFILE.UnlockFile().

func (HFILE) LockFileEx

func (hFile HFILE) LockFileEx(
	flags co.LOCKFILE,
	numBytes uint64,
	overlapped *OVERLAPPED) error

LockFileEx function.

⚠️ You must defer HFILE.UnlockFileEx().

func (HFILE) ReadFile

func (hFile HFILE) ReadFile(
	buffer []byte, overlapped *OVERLAPPED) (numBytesRead uint32, e error)

ReadFile function.

func (HFILE) SetEndOfFile

func (hFile HFILE) SetEndOfFile() error

SetEndOfFile function.

func (HFILE) SetFilePointerEx

func (hFile HFILE) SetFilePointerEx(
	distanceToMove int64,
	moveMethod co.FILE_FROM) (newPointerOffset int64, e error)

SetFilePointerEx function.

In x86 architecture, SetFilePointer will be called instead.

func (HFILE) UnlockFile

func (hFile HFILE) UnlockFile(offset, numBytes uint64) error

UnlockFile function.

func (HFILE) UnlockFileEx

func (hFile HFILE) UnlockFileEx(numBytes uint64, overlapped *OVERLAPPED) error

UnlockFileEx function.

func (HFILE) WriteFile

func (hFile HFILE) WriteFile(
	data []byte, overlapped *OVERLAPPED) (numBytesWritten uint32, e error)

WriteFile function.

type HFILEMAP

type HFILEMAP HANDLE

A handle to a memory-mapped file.

func (HFILEMAP) CloseHandle

func (hMap HFILEMAP) CloseHandle() error

CloseHandle function.

func (HFILEMAP) MapViewOfFile

func (hMap HFILEMAP) MapViewOfFile(
	desiredAccess co.FILE_MAP,
	offset uint64,
	numBytesToMap uint) (HFILEMAPVIEW, error)

MapViewOfFile function.

The offset will be rounded down to a multiple of the allocation granularity, which is taken with GetSystemInfo().

Note that this function may present issues in x86 architectures.

⚠️ You must defer HFILEMAPVIEW.UnmapViewOfFile().

type HFILEMAPVIEW

type HFILEMAPVIEW HANDLE

A handle to the memory block of a memory-mapped file. Actually, this is the starting address of the mapped view.

func (HFILEMAPVIEW) FlushViewOfFile

func (hMem HFILEMAPVIEW) FlushViewOfFile(numBytes uint64) error

FlushViewOfFile function.

func (HFILEMAPVIEW) Ptr

func (hMem HFILEMAPVIEW) Ptr() *byte

Returns a pointer to the beginning of the mapped memory block.

func (HFILEMAPVIEW) UnmapViewOfFile

func (hMem HFILEMAPVIEW) UnmapViewOfFile() error

UnmapViewOfFile function.

type HFIND

type HFIND HANDLE

A handle returned by FindFirstFile function.

func FindFirstFile

func FindFirstFile(fileName string,
	findFileData *WIN32_FIND_DATA) (HFIND, bool, error)

FindFirstFile function.

Returns true if a file was found.

⚠️ You must defer HFIND.FindClose().

func (HFIND) FindClose

func (hFind HFIND) FindClose() error

FindClose function.

func (HFIND) FindNextFile

func (hFind HFIND) FindNextFile(findFileData *WIN32_FIND_DATA) (bool, error)

FindNextFile function.

Returns true if a file was found.

type HFONT

type HFONT HGDIOBJ

A handle to a font.

func CreateFontIndirect

func CreateFontIndirect(lf *LOGFONT) HFONT

CreateFontIndirect function.

⚠️ You must defer HFONT.DeleteObject().

func (HFONT) DeleteObject

func (hFont HFONT) DeleteObject() error

DeleteObject function.

func (HFONT) GetObject

func (hFont HFONT) GetObject(lf *LOGFONT)

GetObject function.

type HGDIOBJ

type HGDIOBJ HANDLE

A handle to a GDI object.

This type is used as the base type for the specialized GDI objects, being rarely used as itself.

func (HGDIOBJ) DeleteObject

func (hGdiObj HGDIOBJ) DeleteObject() error

DeleteObject function.

type HGLOBAL

type HGLOBAL HANDLE

A handle to a global memory block.

func GlobalAlloc

func GlobalAlloc(uFlags co.GMEM, numBytes int) HGLOBAL

GlobalAlloc function.

With co.GMEM_FIXED, the handle itself is the pointer to the memory block, and it can optionally be passed to unsafe.Slice() to create a slice over the memory block.

With co.GMEM_MOVEABLE, you must call HGLOBAL.GlobalLock() to retrieve the pointer.

⚠️ You must defer HGLOBAL.GlobalFree().

Example

hMem := win.GlobalAlloc(co.GMEM_FIXED|co.GMEM_ZEROINIT, 50)
defer hMem.GlobalFree()

sliceMem := hMem.GlobalLock(50)
defer hMem.GlobalUnlock()

func GlobalAllocStr

func GlobalAllocStr(uFlags co.GMEM, s string) HGLOBAL

This helper method calls GlobalAlloc to alloc a null-terminated *uint16.

With co.GMEM_FIXED, the handle itself is the pointer to the memory block, and it can optionally be passed to unsafe.Slice() to create a slice over the memory block.

With co.GMEM_MOVEABLE, you must call HGLOBAL.GlobalLock() to retrieve the pointer.

⚠️ You must defer HGLOBAL.GlobalFree().

Example

hMem := win.GlobalAllocStr(co.GMEM_FIXED, "my text")
defer hMem.GlobalFree()

charSlice := hMem.GlobalLock(hMem.GlobalSize())
defer hMem.GlobalUnlock()

func (HGLOBAL) GlobalFlags

func (hGlobal HGLOBAL) GlobalFlags() co.GMEM

GlobalFlags function.

func (HGLOBAL) GlobalFree

func (hGlobal HGLOBAL) GlobalFree() error

GlobalFree function.

This method is safe to be called if hGlobal is zero.

func (HGLOBAL) GlobalLock

func (hGlobal HGLOBAL) GlobalLock(numBytes int) []byte

GlobalLock function.

If you called GlobalAlloc() with co.GMEM_FIXED, technically you don't need to call this method, because the handle itself is the pointer to the memory block; however, this method is easier to use.

Make sure that numBytes isn't greater than the memory block size, or you'll have a segfault. The safest way is simply call HGLOBAL.GlobalSize().

⚠️ You must defer HGLOBAL.GlobalUnlock(). After that, the slice must not be used.

Example

hMem := win.GlobalAlloc(co.GMEM_FIXED|co.GMEM_ZEROINIT, 50)
defer hMem.GlobalFree()

sliceMem := hMem.GlobalLock(hMem.GlobalSize())
defer hMem.GlobalUnlock()

func (HGLOBAL) GlobalReAlloc

func (hGlobal HGLOBAL) GlobalReAlloc(numBytes int, uFlags co.GMEM) HGLOBAL

GlobalReAlloc function.

⚠️ You must defer HGLOBAL.GlobalFree().

func (HGLOBAL) GlobalSize

func (hGlobal HGLOBAL) GlobalSize() int

GlobalSize function.

func (HGLOBAL) GlobalUnlock

func (hGlobal HGLOBAL) GlobalUnlock() error

GlobalUnlock function.

type HHEAP

type HHEAP HANDLE

Handle to a heap object.

func GetProcessHeap

func GetProcessHeap() HHEAP

GetProcessHeap function.

func HeapCreate

func HeapCreate(
	options co.HEAP_CREATE, initialSize, maximumSize uint) (HHEAP, error)

HeapCreate function.

⚠️ You must defer HHEAP.HeapDestroy().

func (HHEAP) HeapAlloc

func (hHeap HHEAP) HeapAlloc(
	flags co.HEAP_ALLOC, num_bytes uint) ([]byte, error)

HeapAlloc function.

⚠️ You must defer HHEAP.HeapFree().

func (HHEAP) HeapCompact

func (hHeap HHEAP) HeapCompact(flags co.HEAP_NS) (uint, error)

HeapCompact function.

func (HHEAP) HeapDestroy

func (hHeap HHEAP) HeapDestroy() error

HeapDestroy function.

func (HHEAP) HeapFree

func (hHeap HHEAP) HeapFree(flags co.HEAP_NS, block []byte) error

HeapFree function.

func (HHEAP) HeapReAlloc

func (hHeap HHEAP) HeapReAlloc(
	flags co.HEAP_REALLOC, block []byte, num_bytes uint) ([]byte, error)

HeapReAlloc function.

⚠️ You must defer HHEAP.HeapFree().

func (HHEAP) HeapSetInformation

func (hHeap HHEAP) HeapSetInformation(
	informationClass co.HEAP_CLASS,
	information *uint32,
	informationLength int) error

HeapSetInformation function.

func (HHEAP) HeapSize

func (hHeap HHEAP) HeapSize(flags co.HEAP_NS, block []byte) (uint, error)

HeapSize function.

func (HHEAP) HeapValidate

func (hHeap HHEAP) HeapValidate(flags co.HEAP_NS, block []byte) bool

HeapValidate function.

type HHOOK

type HHOOK HANDLE

A handle to a hook.

func SetWindowsHookEx

func SetWindowsHookEx(idHook co.WH,
	callback func(code int32, wp WPARAM, lp LPARAM) uintptr,
	hMod HINSTANCE,
	threadId uint32) (HHOOK, error)

SetWindowsHookEx function.

Note that the callback is recreated each function call, and the number of system callbacks is limited somewhere by the Go runtime.

SetWindowsHookEx() doesn't have a context argument, so everything inside of it depends on global objects.

⚠️ You must defer HHOOK.UnhookWindowsHookEx().

func (HHOOK) CallNextHookEx

func (hHook HHOOK) CallNextHookEx(nCode int32, wp WPARAM, lp LPARAM) uintptr

CallNextHookEx function.

func (HHOOK) UnhookWindowsHookEx

func (hHook HHOOK) UnhookWindowsHookEx() error

UnhookWindowsHookEx function.

type HICON

type HICON HANDLE

A handle to an icon.

func CreateIconFromResourceEx

func CreateIconFromResourceEx(
	resBits []byte, fmtVersion int,
	cxDesired, cyDesired int,
	flags co.LR) (HICON, error)

CreateIconFromResourceEx function.

This function creates HICON only. The HCURSOR variation is CreateCursorFromResourceEx().

⚠️ You must defer HICON.DestroyIcon().

func CreateIconIndirect

func CreateIconIndirect(info *ICONINFO) HICON

CreateIconIndirect function.

⚠️ You must defer HICON.DestroyIcon().

func ExtractIconEx

func ExtractIconEx(fileName string) (largeIcons, smallIcons []HICON)

ExtractIconEx function.

Extracts all icons: big and small.

⚠️ You must defer HICON.DestroyIcon() on each icon returned in both slices.

func (HICON) CopyIcon

func (hIcon HICON) CopyIcon() HICON

CopyIcon function.

⚠️ You must defer HICON.DestroyIcon().

func (HICON) DestroyIcon

func (hIcon HICON) DestroyIcon() error

DestroyIcon function.

func (HICON) GetIconInfo

func (hIcon HICON) GetIconInfo(iconInfo *ICONINFO)

GetIconInfo function.

⚠️ You must defer HBITMAP.DeleteObject() in HbmMask and HbmColor fields.

func (HICON) GetIconInfoEx

func (hIcon HICON) GetIconInfoEx(iconInfoEx *ICONINFOEX)

GetIconInfoEx function.

⚠️ You must defer HBITMAP.DeleteObject() in HbmMask and HbmColor fields.

type HIMAGELIST

type HIMAGELIST HANDLE

A handle to an image list.

func ImageListCreate

func ImageListCreate(
	cx, cy uint32,
	flags co.ILC,
	szInitial, szGrow uint32) HIMAGELIST

ImageList_Create function.

Usually flags is ILC_COLOR32.

⚠️ You must defer HIMAGELIST.Destroy().

func (HIMAGELIST) AddIcon

func (hImg HIMAGELIST) AddIcon(hIcons ...HICON)

ImageList_AddIcon function.

If icon was loaded from resource with LoadIcon(), it doesn't need to be destroyed, because all icon resources are automatically freed. Otherwise, if loaded with CreateIcon(), it must be destroyed.

func (HIMAGELIST) AddIconFromShell

func (hImg HIMAGELIST) AddIconFromShell(fileExtensions ...string)

This helper method calls SHGetFileInfo to load icons from the shell, used by Windows Explorer to represent the given file extensions, like "mp3".

func (HIMAGELIST) Destroy

func (hImg HIMAGELIST) Destroy() error

ImageList_Destroy function.

func (HIMAGELIST) GetIconSize

func (hImg HIMAGELIST) GetIconSize() SIZE

ImageList_GetIconSize function.

func (HIMAGELIST) GetImageCount

func (hImg HIMAGELIST) GetImageCount() uint32

ImageList_GetImageCount function.

func (HIMAGELIST) ReplaceIcon

func (hImg HIMAGELIST) ReplaceIcon(i int32, hIcon HICON) int32

ImageList_ReplaceIcon function.

If icon was loaded from resource with LoadIcon(), it doesn't need to be destroyed, because all icon resources are automatically freed. Otherwise, if loaded with CreateIcon(), it must be destroyed.

type HINSTANCE

type HINSTANCE HANDLE

A handle to an instance. This is the base address of the module in memory.

func GetModuleHandle

func GetModuleHandle(moduleName StrOpt) HINSTANCE

GetModuleHandle function.

If moduleName is nil, returns a handle to the file used to create the calling process (.exe file).

func LoadLibrary

func LoadLibrary(libFileName string) HINSTANCE

LoadLibrary function.

⚠️ You must defer HINSTANCE.FreeLibrary().

func (HINSTANCE) CreateDialogParam

func (hInst HINSTANCE) CreateDialogParam(
	templateName ResId,
	hwndParent HWND,
	dialogFunc uintptr,
	dwInitParam LPARAM) HWND

CreateDialogParam function.

func (HINSTANCE) DialogBoxIndirectParam

func (hInst HINSTANCE) DialogBoxIndirectParam(
	template *DLGTEMPLATE,
	hwndParent HWND,
	dialogFunc uintptr,
	dwInitParam LPARAM) uintptr

DialogBoxIndirectParam function.

func (HINSTANCE) DialogBoxParam

func (hInst HINSTANCE) DialogBoxParam(
	templateName ResId,
	hwndParent HWND,
	dialogFunc uintptr,
	dwInitParam LPARAM) uintptr

DialogBoxParam function.

func (HINSTANCE) DuplicateIcon

func (hInst HINSTANCE) DuplicateIcon(hIcon HICON) HICON

DuplicateIcon function.

func (HINSTANCE) FindResource

func (hInst HINSTANCE) FindResource(
	name ResId, rsrcType RsrcType) (HRSRC, error)

FindResource function.

func (HINSTANCE) FindResourceEx

func (hInst HINSTANCE) FindResourceEx(
	name ResId,
	rsrcType RsrcType,
	language LANGID) (HRSRC, error)

FindResourceEx function.

func (HINSTANCE) FreeLibrary

func (hInst HINSTANCE) FreeLibrary() error

FreeLibrary function.

func (HINSTANCE) GetClassInfoEx

func (hInst HINSTANCE) GetClassInfoEx(
	className *uint16,
	destBuf *WNDCLASSEX) (ATOM, error)

GetClassInfoEx function.

func (HINSTANCE) GetModuleFileName

func (hInst HINSTANCE) GetModuleFileName() string

GetModuleFileName function.

Example

Retrieving own .exe path:

exePath := win.HINSTANCE(0).GetModuleFileName()
fmt.Printf("Current .exe path: %s\n", exePath)

func (HINSTANCE) GetProcAddress

func (hInst HINSTANCE) GetProcAddress(procName string) (uintptr, error)

GetProcAddress function.

func (HINSTANCE) LoadAccelerators

func (hInst HINSTANCE) LoadAccelerators(tableName ResId) HACCEL

LoadAccelerators function.

func (HINSTANCE) LoadCursor

func (hInst HINSTANCE) LoadCursor(cursorName CursorRes) HCURSOR

LoadCursor function.

func (HINSTANCE) LoadIcon

func (hInst HINSTANCE) LoadIcon(iconName IconRes) HICON

LoadIcon function.

func (HINSTANCE) LoadImage

func (hInst HINSTANCE) LoadImage(
	name ResId,
	imgType co.IMAGE,
	cx, cy int32,
	fuLoad co.LR) HGDIOBJ

LoadImage function.

Returned HGDIOBJ must be cast into HBITMAP, HCURSOR or HICON.

⚠️ If the object is not being loaded from the application resources, you must defer its respective DeleteObject().

Examples

Loading a 16x16 icon resource:

const MY_ICON_ID int = 101

hIcon := win.HICON(
	win.GetModuleHandle(win.StrOptNone()).LoadImage(
		win.ResIdInt(MY_ICON_ID),
		co.IMAGE_ICON,
		16, 16,
		co.LR_DEFAULTCOLOR,
	),
)

Loading a bitmap from a file:

hBmp := win.HBITMAP(
	win.HINSTANCE(0).LoadImage(
		win.ResIdStr("C:\\Temp\\image.bmp"),
		co.IMAGE_BITMAP,
		0, 0,
		co.LR_LOADFROMFILE,
	),
)
defer hBmp.DeleteObject()

func (HINSTANCE) LoadMenu

func (hInst HINSTANCE) LoadMenu(menuName ResId) HMENU

LoadMenu function.

func (HINSTANCE) LoadResource

func (hInst HINSTANCE) LoadResource(hResInfo HRSRC) (HRSRCMEM, error)

LoadResource function.

func (HINSTANCE) LockResource

func (hInst HINSTANCE) LockResource(
	hResInfo HRSRC, hResLoaded HRSRCMEM) ([]byte, error)

LockResource function.

This method should belong to HRSRCMEM, but in order to make it safe, we automatically call HINSTANCE.SizeofResource(), so it's implemented here.

func (HINSTANCE) SizeofResource

func (hInst HINSTANCE) SizeofResource(hResInfo HRSRC) (int, error)

SizeofResource function.

type HKEY

type HKEY HANDLE

A handle to a registry key.

const (
	HKEY_CLASSES_ROOT        HKEY = 0x8000_0000
	HKEY_CURRENT_USER        HKEY = 0x8000_0001
	HKEY_LOCAL_MACHINE       HKEY = 0x8000_0002
	HKEY_USERS               HKEY = 0x8000_0003
	HKEY_PERFORMANCE_DATA    HKEY = 0x8000_0004
	HKEY_PERFORMANCE_TEXT    HKEY = 0x8000_0050
	HKEY_PERFORMANCE_NLSTEXT HKEY = 0x8000_0060
	HKEY_CURRENT_CONFIG      HKEY = 0x8000_0005
)

Predefined registry key.

func (HKEY) RegCloseKey

func (hKey HKEY) RegCloseKey() error

RegCloseKey function.

func (HKEY) RegDeleteKey

func (hKey HKEY) RegDeleteKey(subKey string) error

RegDeleteKey function.

func (HKEY) RegDeleteKeyEx

func (hKey HKEY) RegDeleteKeyEx(subKey string, samDesired co.KEY) error

RegDeleteKeyEx function.

samDesired must be KEY_WOW64_32KEY or KEY_WOW64_64KEY.

func (HKEY) RegDeleteKeyValue

func (hKey HKEY) RegDeleteKeyValue(subKey, valueName string) error

RegDeleteKeyValue function.

func (HKEY) RegDeleteTree

func (hKey HKEY) RegDeleteTree(subKey string) error

RegDeleteTree function.

func (HKEY) RegEnumKeyEx

func (hKey HKEY) RegEnumKeyEx() ([]string, error)

RegEnumKeyEx function.

Returns the names of all subkeys within a key.

Example

hKey, _ := win.HKEY_CURRENT_USER.RegOpenKeyEx(
	"Control Panel\\Desktop",
	co.REG_OPTION_NONE,
	co.KEY_READ|co.KEY_ENUMERATE_SUB_KEYS)
defer hKey.RegCloseKey()

subKeys, _ := hKey.RegEnumKeyEx()
for _, subKey := range subKeys {
	println(subKey)
}

func (HKEY) RegEnumValue

func (hKey HKEY) RegEnumValue() ([]_HkeyValueEnum, error)

RegEnumValue function.

Returns the names and types of all values within a key.

Example

hKey, _ := win.HKEY_CURRENT_USER.RegOpenKeyEx(
	"Control Panel\\Keyboard",
	co.REG_OPTION_NONE,
	co.KEY_READ)
defer hKey.RegCloseKey()

values, _ := hKey.RegEnumValue()
for _, value := range values {
	println(value.Name)
}

func (HKEY) RegFlushKey

func (hKey HKEY) RegFlushKey() error

RegFlushKey function.

func (HKEY) RegGetValue

func (hKey HKEY) RegGetValue(subKey, value StrOpt) (RegVal, error)

RegGetValue function.

Example

hKey, _ := win.HKEY_CURRENT_USER.RegOpenKeyEx(
	"Control Panel\\Sound",
	co.REG_OPTION_NONE,
	co.KEY_READ)
defer hKey.RegCloseKey()

regVal, _ := hKey.RegGetValue(
	win.StrOptNone(),
	win.StrOptSome("Beep"))
if val, ok := regVal.Sz(); ok {
	println(val)
}

func (HKEY) RegOpenKeyEx

func (hKey HKEY) RegOpenKeyEx(
	subKey string,
	ulOptions co.REG_OPTION,
	samDesired co.KEY) (HKEY, error)

RegOpenKeyEx function.

⚠️ You must defer HKEY.RegCloseKey().

Example

hKey, _ := win.HKEY_CURRENT_USER.RegOpenKeyEx(
	"Control Panel\\Keyboard",
	co.REG_OPTION_NONE,
	co.KEY_READ)
defer hKey.RegCloseKey()

func (HKEY) RegQueryInfoKey

func (hKey HKEY) RegQueryInfoKey() (_HkeyInfo, error)

RegQueryInfoKey function.

Example

hKey, _ := win.HKEY_CURRENT_USER.RegOpenKeyEx(
	"Control Panel\\Desktop",
	co.REG_OPTION_NONE,
	co.KEY_READ)
defer hKey.RegCloseKey()

nfo, _ := hKey.RegQueryInfoKey()
println(nfo.NumSubKeys, nfo.NumValues,
	nfo.LastWriteTime.Format(time.ANSIC))

func (HKEY) RegSetKeyValue

func (hKey HKEY) RegSetKeyValue(subKey, value StrOpt, data RegVal) error

RegSetKeyValue function.

Example

hKey, _ := win.HKEY_CURRENT_USER.RegOpenKeyEx(
	"Control Panel\\Sound",
	co.REG_OPTION_NONE,
	co.KEY_READ|co.KEY_WRITE)
defer hKey.RegCloseKey()

newData := win.RegValSz("yes")
hKey.RegSetKeyValue(
	win.StrOptNone(),
	win.StrOptSome("Beep"),
	newData)

type HLOCAL

type HLOCAL HANDLE

A handle to a local memory block.

func LocalAlloc

func LocalAlloc(uFlags co.LMEM, numBytes int) HLOCAL

LocalAlloc function.

With co.LMEM_FIXED, the handle itself is the pointer to the memory block, and it can optionally be passed to unsafe.Slice() to create a slice over the memory block.

With co.LMEM_MOVEABLE, you must call HLOCAL.LocalLock() to retrieve the pointer.

⚠️ You must defer HLOCAL.LocalFree().

Example:

hMem := win.LocalAlloc(co.LMEM_FIXED|co.LMEM_ZEROINIT, 50)
defer hMem.LocalFree()

sliceMem := hMem.LocalLock(50)
defer hMem.LocalUnlock()

func (HLOCAL) LocalFlags

func (hLocal HLOCAL) LocalFlags() co.LMEM

LocalFlags function.

func (HLOCAL) LocalFree

func (hLocal HLOCAL) LocalFree() error

LocalFree function.

This method is safe to be called if hLocal is zero.

func (HLOCAL) LocalLock

func (hLocal HLOCAL) LocalLock(numBytes int) []byte

LocalLock function.

If you called LocalAlloc() with co.LMEM_FIXED, technically you don't need to call this method, because the handle itself is the pointer to the memory block; however, this method is easier to use.

Make sure that numBytes isn't greater than the memory block size, or you'll have a segfault. The safest way is simply call HLOCAL.LocalSize().

⚠️ You must defer HLOCAL.LocalUnlock(). After that, the slice must not be used.

Example:

hMem := win.LocalAlloc(co.LMEM_FIXED|co.LMEM_ZEROINIT, 50)
defer hMem.LocalFree()

sliceMem := hMem.LocalLock(hMem.LocalSize())
defer hMem.LocalUnlock()

func (HLOCAL) LocalReAlloc

func (hLocal HLOCAL) LocalReAlloc(numBytes int, uFlags co.LMEM) HLOCAL

LocalReAlloc function.

⚠️ You must defer HLOCAL.LocalFree().

func (HLOCAL) LocalSize

func (hLocal HLOCAL) LocalSize() int

LocalSize function.

func (HLOCAL) LocalUnlock

func (hLocal HLOCAL) LocalUnlock() error

LocalUnlock function.

type HMENU

type HMENU HANDLE

A handle to a menu.

func CreateMenu

func CreateMenu() HMENU

CreateMenu function.

⚠️ You must defer HMENU.DestroyMenu(), unless it's attached to a window.

func CreatePopupMenu

func CreatePopupMenu() HMENU

CreatePopupMenu function.

⚠️ You must defer HMENU.DestroyMenu(), unless it's attached to a window.

func (HMENU) AddItem

func (hMenu HMENU) AddItem(cmdId int, text string) HMENU

This helper method appends a new item to the menu, by calling HMENU.AppendMenu(). Returns the same menu, so you can chain multiple calls.

func (HMENU) AddSeparator

func (hMenu HMENU) AddSeparator() HMENU

This helper method appends a new separator to the menu, by calling HMENU.AppendMenu(). Returns the same menu, so you can chain multiple calls.

func (HMENU) AddSubmenu

func (hMenu HMENU) AddSubmenu(text string, hSubMenu HMENU)

This helper method appends a new submenu to the menu, by calling HMENU.AppendMenu().

func (HMENU) AppendMenu

func (hMenu HMENU) AppendMenu(
	uFlags co.MF, uIDNewItem interface{}, lpNewItem interface{})

AppendMenu function.

This function is rather tricky. Prefer using HMENU.AddItem(), HMENU.AddSeparator() or HMENU.AddSubmenu().

⚠️ uIDNewItem must be uint16 or HMENU.

⚠️ lpNewItem must be HBITMAP, LPARAM or string.

func (HMENU) CheckMenuItem

func (hMenu HMENU) CheckMenuItem(item MenuItem, check bool) bool

CheckMenuItem function.

Example:

var hMenu win.HMENU // initialized somewhere

hMenu.CheckMenuItem(win.MenuItemPos(0), true)

func (HMENU) CheckMenuRadioItem

func (hMenu HMENU) CheckMenuRadioItem(
	firstItem, lastItem, checkedItem MenuItem)

CheckMenuRadioItem function.

Panics if the three item identifiers don't have the same variant type.

Example:

var hMenu win.HMENU // initialized somewhere

p.Hmenu().CheckMenuRadioItem(
	win.MenuItemPos(0), win.MenuItemPos(4), win.MenuItemPos(1))

func (HMENU) DeleteMenu

func (hMenu HMENU) DeleteMenu(item MenuItem)

DeleteMenu function.

Example:

var hMenu win.HMENU // initialized somewhere

hMenu.DeleteMenu(win.MenuItemPos(3))

func (HMENU) DestroyMenu

func (hMenu HMENU) DestroyMenu() error

DestroyMenu function.

func (HMENU) EnableMenuItem

func (hMenu HMENU) EnableMenuItem(item MenuItem, enable bool) bool

EnableMenuItem function.

Example:

var hMenu win.HMENU // initialized somewhere

hMenu.EnableMenuItem(win.MenuItemPos(0), false)

func (HMENU) GetMenuDefaultItem

func (hMenu HMENU) GetMenuDefaultItem(gmdiFlags co.GMDI) (pos MenuItem)

GetMenuDefaultItem function.

func (HMENU) GetMenuItemCount

func (hMenu HMENU) GetMenuItemCount() uint32

GetMenuItemCount function.

func (HMENU) GetMenuItemID

func (hMenu HMENU) GetMenuItemID(pos uint32) int32

GetMenuItemID function.

func (HMENU) GetMenuItemInfo

func (hMenu HMENU) GetMenuItemInfo(item MenuItem, mii *MENUITEMINFO)

GetMenuItemInfo function.

func (HMENU) GetSubMenu

func (hMenu HMENU) GetSubMenu(pos uint32) (HMENU, bool)

GetSubMenu function.

func (HMENU) InsertMenuItem

func (hMenu HMENU) InsertMenuItem(itemBefore MenuItem, mii *MENUITEMINFO)

InsertMenuItem function.

func (HMENU) RemoveMenu

func (hMenu HMENU) RemoveMenu(item MenuItem)

RemoveMenu function.

func (HMENU) SetMenuDefaultItem

func (hMenu HMENU) SetMenuDefaultItem(item MenuItem)

SetMenuDefaultItem function.

func (HMENU) SetMenuInfo

func (hMenu HMENU) SetMenuInfo(info *MENUINFO)

SetMenuInfo function.

func (HMENU) SetMenuItemBitmaps

func (hMenu HMENU) SetMenuItemBitmaps(
	item MenuItem, hBmpUnchecked, hBmpChecked HBITMAP)

SetMenuItemBitmaps function.

func (HMENU) SetMenuItemInfo

func (hMenu HMENU) SetMenuItemInfo(item MenuItem, info *MENUITEMINFO)

SetMenuItemInfo function.

func (HMENU) ShowAtPoint

func (hMenu HMENU) ShowAtPoint(pos POINT, hParent, hCoordsRelativeTo HWND)

This helper method shows the popup menu anchored at the given coordinates, using HMENU.TrackPopupMenu().

If hCoordsRelativeTo is zero, coordinates must be relative to hParent.

This function will block until the menu disappears.

func (HMENU) TrackPopupMenu

func (hMenu HMENU) TrackPopupMenu(flags co.TPM, x, y int32, hWnd HWND) int

TrackPopupMenu function.

This function will block until the menu disappears. If TPM_RETURNCMD is passed, returns the selected command ID.

type HMONITOR

type HMONITOR HANDLE

Handle to a display monitor.

func MonitorFromPoint

func MonitorFromPoint(pt POINT, flags co.MONITOR) HMONITOR

MonitorFromPoint function.

func MonitorFromRect

func MonitorFromRect(rc RECT, flags co.MONITOR) HMONITOR

MonitorFromRect function.

func (HMONITOR) GetMonitorInfo

func (hMon HMONITOR) GetMonitorInfo(mi *MONITORINFOEX) error

GetMonitorInfo function.

type HPEN

type HPEN HGDIOBJ

A handle to a pen.

func CreatePen

func CreatePen(style co.PS, width int32, color COLORREF) HPEN

CreatePen function.

⚠️ You must defer HPEN.DeleteObject().

func CreatePenIndirect

func CreatePenIndirect(lp *LOGPEN) HPEN

CreatePenIndirect function.

func (HPEN) DeleteObject

func (hPen HPEN) DeleteObject() error

DeleteObject function.

func (HPEN) GetObject

func (hPen HPEN) GetObject(lp *LOGPEN)

GetObject function.

type HPIPE

type HPIPE HANDLE

A handle to a pipe.

func CreateNamedPipe

func CreateNamedPipe(
	name string,
	dwOpenMode co.PIPE_ACCESS,
	dwPipeMode co.PIPE,
	nMaxInstances uint,
	nOutBufferSize uint,
	nInBufferSize uint,
	nDefaultTimeOut uint,
	securityAttributes *SECURITY_ATTRIBUTES) (HPIPE, error)

CreateNamedPipe function.

⚠️ You must defer HPIPE.CloseHandle().

func (HPIPE) CloseHandle

func (hPipe HPIPE) CloseHandle() error

CloseHandle function.

func (HPIPE) ConnectNamedPipe

func (hPipe HPIPE) ConnectNamedPipe() error

ConnectNamedPipe function.

func (HPIPE) DisconnectNamedPipe

func (hPipe HPIPE) DisconnectNamedPipe() error

DisconnectNamedPipe function.

func (HPIPE) GetNamedPipeInfo

func (hPipe HPIPE) GetNamedPipeInfo() (_HpipeInfo, error)

GetNamedPipeInfo function.

func (HPIPE) PeekNamedPipe

func (hPipe HPIPE) PeekNamedPipe(buffer []byte) (_HpipePeek, error)

PeekNamedPipe function.

func (HPIPE) ReadFile

func (hPipe HPIPE) ReadFile(
	buffer []byte, overlapped *OVERLAPPED) (numBytesRead uint32, e error)

ReadFile function.

func (HPIPE) WriteFile

func (hPipe HPIPE) WriteFile(
	data []byte, overlapped *OVERLAPPED) (numBytesWritten uint32, e error)

WriteFile function.

type HPROCESS

type HPROCESS HANDLE

Handle to a process.

func GetCurrentProcess

func GetCurrentProcess() HPROCESS

GetCurrentProcess function.

⚠️ You must defer HPROCESS.CloseHandle().

func OpenProcess

func OpenProcess(
	desiredAccess co.PROCESS,
	inheritHandle bool,
	processId uint32) (HPROCESS, error)

OpenProcess function.

⚠️ You must defer HPROCESS.CloseHandle().

func (HPROCESS) CloseHandle

func (hProcess HPROCESS) CloseHandle() error

CloseHandle function.

func (HPROCESS) EnumProcessModules

func (hProcess HPROCESS) EnumProcessModules() ([]HINSTANCE, error)

EnumProcessModules function.

func (HPROCESS) GetExitCodeProcess

func (hProcess HPROCESS) GetExitCodeProcess() (uint32, error)

GetExitCodeProcess function.

func (HPROCESS) GetModuleBaseName

func (hProcess HPROCESS) GetModuleBaseName(hModule HINSTANCE) (string, error)

GetModuleBaseName function.

func (HPROCESS) GetProcessId

func (hProcess HPROCESS) GetProcessId() (uint32, error)

GetProcessId function.

func (HPROCESS) GetProcessTimes

func (hProcess HPROCESS) GetProcessTimes() (
	creationTime, exitTime, kernelTime, userTime FILETIME, e error)

GetProcessTimes function.

func (HPROCESS) OpenProcessToken

func (hProcess HPROCESS) OpenProcessToken(
	desiredAccess co.TOKEN) (HACCESSTOKEN, error)

OpenProcessToken function.

⚠️ You must defer HACCESSTOKEN.CloseHandle().

Example

hProcess := GetCurrentProcess()

hToken, _ := hProcess.OpenProcessToken(co.TOKEN_EXECUTE)
defer hToken.CloseHandle()

func (HPROCESS) ReadProcessMemory

func (hProcess HPROCESS) ReadProcessMemory(
	baseAddress uintptr,
	buffer []byte) (numBytesRead uint64, e error)

ReadProcessMemory function.

func (HPROCESS) SetUserObjectInformation

func (hProcess HPROCESS) SetUserObjectInformation(
	index co.UOI,
	info unsafe.Pointer,
	infoLen uintptr) error

SetUserObjectInformation function.

func (HPROCESS) TerminateProcess

func (hProcess HPROCESS) TerminateProcess(exitCode uint32) error

TerminateProcess function.

func (HPROCESS) WaitForSingleObject

func (hProcess HPROCESS) WaitForSingleObject(milliseconds NumInf) (co.WAIT, error)

WaitForSingleObject function.

func (HPROCESS) WriteProcessMemory

func (hProcess HPROCESS) WriteProcessMemory(
	baseAddress uintptr,
	data []byte) (numBytesWritten uint64, e error)

WriteProcessMemory function.

type HPROCSNAPSHOT

type HPROCSNAPSHOT HANDLE

Handle to a process snapshot.

func CreateToolhelp32Snapshot

func CreateToolhelp32Snapshot(
	flags co.TH32CS, processId uint32) (HPROCSNAPSHOT, error)

CreateToolhelp32Snapshot function.

⚠️ You must defer HPROCSNAPSHOT.CloseHandle().

func (HPROCSNAPSHOT) CloseHandle

func (hProcSnap HPROCSNAPSHOT) CloseHandle() error

CloseHandle function.

func (HPROCSNAPSHOT) EnumModules

func (hProcSnap HPROCSNAPSHOT) EnumModules(
	callback func(me32 *MODULEENTRY32) bool) error

This helper method enumerates all modules.

To continue enumeration, the callback function must return true; to stop enumeration, return false.

func (HPROCSNAPSHOT) EnumProcesses

func (hProcSnap HPROCSNAPSHOT) EnumProcesses(
	callback func(me32 *PROCESSENTRY32) bool) error

This helper method enumerates all processes.

To continue enumeration, the callback function must return true; to stop enumeration, return false.

func (HPROCSNAPSHOT) EnumThreads

func (hProcSnap HPROCSNAPSHOT) EnumThreads(
	callback func(me32 *THREADENTRY32) bool) error

This helper method enumerates all threads.

To continue enumeration, the callback function must return true; to stop enumeration, return false.

func (HPROCSNAPSHOT) Module32First

func (hProcSnap HPROCSNAPSHOT) Module32First(buf *MODULEENTRY32) (bool, error)

Module32First function.

This function is rather tricky. Prefer using HPROCSNAPSHOT.EnumModules().

func (HPROCSNAPSHOT) Module32Next

func (hProcSnap HPROCSNAPSHOT) Module32Next(buf *MODULEENTRY32) (bool, error)

Module32Next function.

This function is rather tricky. Prefer using HPROCSNAPSHOT.EnumModules().

func (HPROCSNAPSHOT) Process32First

func (hProcSnap HPROCSNAPSHOT) Process32First(
	buf *PROCESSENTRY32) (bool, error)

Process32First function.

This function is rather tricky. Prefer using HPROCSNAPSHOT.EnumProcesses().

func (HPROCSNAPSHOT) Process32Next

func (hProcSnap HPROCSNAPSHOT) Process32Next(
	buf *PROCESSENTRY32) (bool, error)

Process32Next function.

This function is rather tricky. Prefer using HPROCSNAPSHOT.EnumProcesses().

func (HPROCSNAPSHOT) Thread32First

func (hProcSnap HPROCSNAPSHOT) Thread32First(buf *THREADENTRY32) (bool, error)

Thread32First function.

This function is rather tricky. Prefer using HPROCSNAPSHOT.EnumThreads().

func (HPROCSNAPSHOT) Thread32Next

func (hProcSnap HPROCSNAPSHOT) Thread32Next(buf *THREADENTRY32) (bool, error)

Thread32Next function.

This function is rather tricky. Prefer using HPROCSNAPSHOT.EnumThreads().

type HRGN

type HRGN HGDIOBJ

A handle to a region.

func CreateEllipticRgn

func CreateEllipticRgn(boundTopLeft, boundBottomRight POINT) HRGN

CreateEllipticRgn function.

⚠️ You must defer HRGN.DeleteObject().

func CreateRectRgnIndirect

func CreateRectRgnIndirect(rc *RECT) HRGN

CreateRectRgnIndirect function.

⚠️ You must defer HRGN.DeleteObject().

func CreateRoundRectRgn

func CreateRoundRectRgn(topLeft, bottomRight POINT, szEllipse SIZE) HRGN

CreateRoundRectRgn function.

⚠️ You must defer HRGN.DeleteObject().

func (HRGN) CombineRgn

func (hRgn HRGN) CombineRgn(hrgnSrc1, hrgnSrc2 HRGN, mode co.RGN) co.REGION

CombineRgn function.

Combines the two regions and stores the result in current region.

func (HRGN) DeleteObject

func (hRgn HRGN) DeleteObject() error

DeleteObject function.

func (HRGN) OffsetRgn

func (hRgn HRGN) OffsetRgn(x, y int32) co.REGION

OffsetRgn function.

type HRSRC

type HRSRC HANDLE

A handle to a resource.

type HRSRCMEM

type HRSRCMEM HANDLE

A handle to a resource memory block.

type HSTDHANDLE

type HSTDHANDLE HANDLE

A handle to a standard device – standard input, standard output, or standard error.

func GetStdHandle

func GetStdHandle(handle co.STD) (HSTDHANDLE, error)

GetStdHandle function.

func (HSTDHANDLE) GetCurrentConsoleFont

func (hStd HSTDHANDLE) GetCurrentConsoleFont(
	maximumWindow bool,
	info *CONSOLE_FONT_INFO) error

GetCurrentConsoleFont function.

func (HSTDHANDLE) ReadConsole

func (hStd HSTDHANDLE) ReadConsole(
	maxChars int,
	inputControl *CONSOLE_READCONSOLE_CONTROL) (string, error)

ReadConsole function.

func (HSTDHANDLE) SetConsoleCursorInfo

func (hStd HSTDHANDLE) SetConsoleCursorInfo(info *CONSOLE_CURSOR_INFO) error

SetConsoleCursorInfo function.

func (HSTDHANDLE) SetConsoleCursorPosition

func (hStd HSTDHANDLE) SetConsoleCursorPosition(x, y int) error

SetConsoleCursorPosition function.

func (HSTDHANDLE) SetConsoleDisplayMode

func (hStd HSTDHANDLE) SetConsoleDisplayMode(mode co.CONSOLE) (SIZE, error)

SetConsoleDisplayMode function.

func (HSTDHANDLE) SetConsoleMode

func (hStd HSTDHANDLE) SetConsoleMode(mode co.ENABLE) error

SetConsoleMode function.

func (HSTDHANDLE) SetConsoleScreenBufferSize

func (hStd HSTDHANDLE) SetConsoleScreenBufferSize(x, y int) error

SetConsoleScreenBufferSize function.

func (HSTDHANDLE) WriteConsole

func (hStd HSTDHANDLE) WriteConsole(text string) (numCharsWritten int, e error)

WriteConsole function.

type HSZ

type HSZ HANDLE

DDE string handle.

type HTASKMEM

type HTASKMEM HANDLE

Handle to an OLE block of memory.

func CoTaskMemAlloc

func CoTaskMemAlloc(numBytes int) HTASKMEM

CoTaskMemAlloc function.

⚠️ You must defer HTASKMEM.CoTaskMemFree().

func (HTASKMEM) CoTaskMemFree

func (hMem HTASKMEM) CoTaskMemFree()

CoTaskMemFree function.

func (HTASKMEM) CoTaskMemRealloc

func (hMem HTASKMEM) CoTaskMemRealloc(numBytes int) HTASKMEM

CoTaskMemRealloc function.

⚠️ You must defer CoTaskMemFree().

type HTHEME

type HTHEME HANDLE

Handle to a theme.

func (HTHEME) CloseThemeData

func (hTheme HTHEME) CloseThemeData()

CloseThemeData function.

func (HTHEME) DrawThemeBackground

func (hTheme HTHEME) DrawThemeBackground(
	hdc HDC, partStateId co.VS, rc *RECT, clipRc *RECT)

DrawThemeBackground function.

func (HTHEME) GetThemeColor

func (hTheme HTHEME) GetThemeColor(partStateId co.VS, propId co.TMT) COLORREF

GetThemeColor function.

func (HTHEME) GetThemeInt

func (hTheme HTHEME) GetThemeInt(partStateId co.VS, propId co.TMT) int32

GetThemeInt function.

func (HTHEME) GetThemeMetric

func (hTheme HTHEME) GetThemeMetric(
	hdc HDC, partStateId co.VS, propId co.TMT) int32

GetThemeMetric function.

func (HTHEME) GetThemePosition

func (hTheme HTHEME) GetThemePosition(partStateId co.VS, propId co.TMT) POINT

GetThemePosition function.

func (HTHEME) GetThemePropertyOrigin

func (hTheme HTHEME) GetThemePropertyOrigin(
	partStateId co.VS, propId co.TMT) co.PROPERTYORIGIN

GetThemePropertyOrigin function.

func (HTHEME) GetThemeRect

func (hTheme HTHEME) GetThemeRect(partStateId co.VS, propId co.TMT) RECT

GetThemeRect function.

func (HTHEME) GetThemeString

func (hTheme HTHEME) GetThemeString(partStateId co.VS, propId co.TMT) string

GetThemeString function.

func (HTHEME) GetThemeSysColorBrush

func (hTheme HTHEME) GetThemeSysColorBrush(colorId co.TMT) HBRUSH

GetThemeSysColorBrush function.

⚠️ You must defer HBRUSH.DeleteObject().

func (HTHEME) GetThemeSysFont

func (hTheme HTHEME) GetThemeSysFont(fontId co.TMT, lf *LOGFONT)

GetThemeSysFont function.

func (HTHEME) GetThemeTextMetrics

func (hTheme HTHEME) GetThemeTextMetrics(
	hdc HDC, partStateId co.VS, tm *TEXTMETRIC)

GetThemeTextMetrics function.

func (HTHEME) IsThemeBackgroundPartiallyTransparent

func (hTheme HTHEME) IsThemeBackgroundPartiallyTransparent(partStateId co.VS) bool

IsThemeBackgroundPartiallyTransparent function.

func (HTHEME) IsThemePartDefined

func (hTheme HTHEME) IsThemePartDefined(partStateId co.VS) bool

IsThemePartDefined function.

type HTHREAD

type HTHREAD HANDLE

Handle to a thread.

func GetCurrentThread

func GetCurrentThread() HTHREAD

GetCurrentThread function.

⚠️ You must defer HTHREAD.CloseHandle().

func (HTHREAD) CloseHandle

func (hThread HTHREAD) CloseHandle() error

CloseHandle function.

func (HTHREAD) GetExitCodeThread

func (hThread HTHREAD) GetExitCodeThread() (uint32, error)

GetExitCodeThread function.

func (HTHREAD) GetProcessIdOfThread

func (hThread HTHREAD) GetProcessIdOfThread() (uint32, error)

GetProcessIdOfThread function.

func (HTHREAD) GetThreadId

func (hThread HTHREAD) GetThreadId() (uint32, error)

GetThreadId function.

func (HTHREAD) GetThreadTimes

func (hThread HTHREAD) GetThreadTimes() (
	creationTime, exitTime, kernelTime, userTime FILETIME, e error)

GetThreadTimes function.

func (HTHREAD) ResumeThread

func (hThread HTHREAD) ResumeThread() (uint32, error)

ResumeThread function.

func (HTHREAD) SuspendThread

func (hThread HTHREAD) SuspendThread() (uint32, error)

SuspendThread function.

func (HTHREAD) TerminateThread

func (hThread HTHREAD) TerminateThread(exitCode uint32) error

TerminateThread function.

func (HTHREAD) WaitForSingleObject

func (hThread HTHREAD) WaitForSingleObject(milliseconds NumInf) (co.WAIT, error)

WaitForSingleObject function.

type HTREEITEM

type HTREEITEM HANDLE

A handle to a tree view control item.

const (
	HTREEITEM_ROOT  HTREEITEM = 0x1_0000
	HTREEITEM_FIRST HTREEITEM = 0x0_ffff
	HTREEITEM_LAST  HTREEITEM = 0x0_fffe
	HTREEITEM_SORT  HTREEITEM = 0x0_fffd
)

Predefined tree view control item handle.

type HWND

type HWND HANDLE

A handle to a window.

func CreateWindowEx

func CreateWindowEx(
	exStyle co.WS_EX,
	className ClassName,
	title StrOpt,
	style co.WS,
	x, y, width, height int32,
	parent HWND,
	menu HMENU,
	instance HINSTANCE,
	param LPARAM) HWND

CreateWindowEx function.

func FindWindow

func FindWindow(className ClassName, title StrOpt) (HWND, bool)

FindWindow function.

func GetClipboardOwner

func GetClipboardOwner() HWND

GetClipboardOwner function.

func GetConsoleWindow

func GetConsoleWindow() HWND

GetConsoleWindow function.

func GetDesktopWindow

func GetDesktopWindow() HWND

GetDesktopWindow function.

func GetFocus

func GetFocus() HWND

GetFocus function.

func GetForegroundWindow

func GetForegroundWindow() HWND

GetForegroundWindow function.

func GetOpenClipboardWindow

func GetOpenClipboardWindow() HWND

GetOpenClipboardWindow function.

func GetShellWindow

func GetShellWindow() HWND

GetShellWindow function.

func (HWND) BeginPaint

func (hWnd HWND) BeginPaint(ps *PAINTSTRUCT) HDC

BeginPaint function.

⚠️ You must defer HWND.EndPaint().

func (HWND) ChildWindowFromPoint

func (hWnd HWND) ChildWindowFromPoint(pt POINT) (HWND, bool)

ChildWindowFromPoint function.

func (HWND) ChildWindowFromPointEx

func (hWnd HWND) ChildWindowFromPointEx(pt POINT, flags co.CWP) (HWND, bool)

ChildWindowFromPointEx function.

func (HWND) ClientToScreenPt

func (hWnd HWND) ClientToScreenPt(pt *POINT)

ClientToScreenPt function.

func (HWND) ClientToScreenRc

func (hWnd HWND) ClientToScreenRc(rc *RECT)

ClientToScreenRc function.

func (HWND) DefDlgProc

func (hWnd HWND) DefDlgProc(msg co.WM, wParam WPARAM, lParam LPARAM) uintptr

DefDlgProc function.

func (HWND) DefSubclassProc

func (hWnd HWND) DefSubclassProc(
	msg co.WM, wParam WPARAM, lParam LPARAM) uintptr

DefSubclassProc function.

func (HWND) DefWindowProc

func (hWnd HWND) DefWindowProc(
	msg co.WM, wParam WPARAM, lParam LPARAM) uintptr

DefWindowProc function.

func (HWND) DestroyWindow

func (hWnd HWND) DestroyWindow() error

DestroyWindow function.

Note: don't call this function to close a window. The correct way to close a window is calling SendMessage with WM_CLOSE.

func (HWND) DragAcceptFiles

func (hWnd HWND) DragAcceptFiles(accept bool)

DragAcceptFiles function.

func (HWND) DrawMenuBar

func (hWnd HWND) DrawMenuBar()

DrawMenuBar function.

func (HWND) DwmExtendFrameIntoClientArea

func (hWnd HWND) DwmExtendFrameIntoClientArea(marginsInset *MARGINS)

DwmExtendFrameIntoClientArea function.

func (HWND) DwmGetWindowAttribute

func (hWnd HWND) DwmGetWindowAttribute(attr co.DWMWA_GET) interface{}

DwmGetWindowAttribute function.

Example

var hwnd win.HWND // initialized somewhere

isEnabled := hwnd.DwmGetWindowAttribute(
	co.DWMWA_GET_NCRENDERING_ENABLED).(bool)

rect := hwnd.DwmGetWindowAttribute(
	co.DWMWA_GET_CAPTION_BUTTON_BOUNDS).(win.RECT)

func (HWND) DwmInvalidateIconicBitmaps

func (hWnd HWND) DwmInvalidateIconicBitmaps()

DwmInvalidateIconicBitmaps function.

func (HWND) DwmSetIconicLivePreviewBitmap

func (hWnd HWND) DwmSetIconicLivePreviewBitmap(
	hBmp HBITMAP, ptClient POINT, sitFlags co.DWM_SIT)

DwmSetIconicLivePreviewBitmap function.

func (HWND) DwmSetIconicThumbnail

func (hWnd HWND) DwmSetIconicThumbnail(hBmp HBITMAP, sitFlags co.DWM_SIT)

DwmSetIconicThumbnail function.

func (HWND) DwmSetWindowAttribute

func (hWnd HWND) DwmSetWindowAttribute(attr co.DWMWA_SET, val interface{})

DwmSetWindowAttribute function.

Example

var hwnd win.HWND // initialized somewhere

hwnd.DwmSetWindowAttribute(
	co.DWMWA_SET_NCRENDERING_POLICY, co.DWMNCRP_DISABLED)

hwnd.DwmSetWindowAttribute(
	co.DWMWA_SET_TRANSITIONS_FORCEDISABLED, true)

func (HWND) EnableWindow

func (hWnd HWND) EnableWindow(enable bool) bool

EnableWindow function.

func (HWND) EndDialog

func (hWnd HWND) EndDialog(result uintptr) error

EndDialog function.

func (HWND) EndPaint

func (hWnd HWND) EndPaint(ps *PAINTSTRUCT)

EndPaint function.

func (HWND) EnumChildWindows

func (hWnd HWND) EnumChildWindows(callback func(hChild HWND) bool)

EnumChildWindows function.

To continue enumeration, the callback function must return true; to stop enumeration, it must return false.

func (HWND) GetAncestor

func (hWnd HWND) GetAncestor(gaFlags co.GA) HWND

GetAncestor function.

func (HWND) GetClassLongPtr

func (hWnd HWND) GetClassLongPtr(index co.GCL) uint32

GetClassLongPtr function.

func (HWND) GetClassName

func (hWnd HWND) GetClassName() string

GetClassName function.

func (HWND) GetClientRect

func (hWnd HWND) GetClientRect() RECT

GetClientRect function.

func (HWND) GetDC

func (hWnd HWND) GetDC() HDC

GetDC function.

Call HWND(0).GetDC() to retrieve the DC for the entire screen.

⚠️ You must defer HDC.ReleaseDC().

func (HWND) GetDlgCtrlID

func (hWnd HWND) GetDlgCtrlID() int32

GetDlgCtrlID function.

func (HWND) GetDlgItem

func (hWnd HWND) GetDlgItem(dlgId int32) HWND

GetDlgItem function.

func (HWND) GetLastActivePopup

func (hWnd HWND) GetLastActivePopup() HWND

GetLastActivePopup function.

func (HWND) GetMenu

func (hWnd HWND) GetMenu() HMENU

GetMenu function.

func (HWND) GetNextDlgGroupItem

func (hWnd HWND) GetNextDlgGroupItem(hChild HWND, isPrevious bool) HWND

GetNextDlgGroupItem function.

func (HWND) GetNextDlgTabItem

func (hWnd HWND) GetNextDlgTabItem(hChild HWND, isPrevious bool) HWND

GetNextDlgTabItem function.

func (HWND) GetParent

func (hWnd HWND) GetParent() HWND

GetParent function.

func (HWND) GetScrollInfo

func (hWnd HWND) GetScrollInfo(bar co.SB_TYPE, si *SCROLLINFO)

GetScrollInfo function.

func (HWND) GetSystemMenu

func (hWnd HWND) GetSystemMenu(revert bool) HMENU

GetSystemMenu function.

func (HWND) GetTopWindow

func (hWnd HWND) GetTopWindow() HWND

GetTopWindow function.

func (HWND) GetWindow

func (hWnd HWND) GetWindow(cmd co.GW) HWND

GetWindow function.

func (HWND) GetWindowDC

func (hWnd HWND) GetWindowDC() HDC

GetWindowDC function.

⚠️ You must defer HDC.ReleaseDC().

func (HWND) GetWindowLongPtr

func (hWnd HWND) GetWindowLongPtr(index co.GWLP) uintptr

GetWindowLongPtr function.

func (HWND) GetWindowRect

func (hWnd HWND) GetWindowRect() RECT

GetWindowRect function.

func (HWND) GetWindowText

func (hWnd HWND) GetWindowText() string

GetWindowText function.

Calls GetWindowTextLength to allocate the memory block.

func (HWND) GetWindowTextLength

func (hWnd HWND) GetWindowTextLength() int32

GetWindowTextLength function.

You usually don't need to call this function since GetWindowText already calls it to allocate the memory block.

func (HWND) GetWindowThreadProcessId

func (hWnd HWND) GetWindowThreadProcessId() (threadId, processId uint32)

GetWindowThreadProcessId function.

func (HWND) HideCaret

func (hWnd HWND) HideCaret()

HideCaret function.

func (HWND) HiliteMenuItem

func (hWnd HWND) HiliteMenuItem(hMenu HMENU, item MenuItem, hilite bool) bool

HiliteMenuItem function.

func (HWND) Hinstance

func (hWnd HWND) Hinstance() HINSTANCE

This helper method returns the window instance with GetWindowLongPtr().

func (HWND) InvalidateRect

func (hWnd HWND) InvalidateRect(rc *RECT, erase bool)

InvalidateRect function.

func (HWND) IsChild

func (hWnd HWND) IsChild(hChild HWND) bool

IsChild function.

func (HWND) IsDialogMessage

func (hWnd HWND) IsDialogMessage(msg *MSG) bool

IsDialogMessage function.

func (HWND) IsDlgButtonChecked

func (hWnd HWND) IsDlgButtonChecked(idButton int32) co.BST

IsDlgButtonChecked function.

func (HWND) IsIconic

func (hWnd HWND) IsIconic() bool

IsIconic function.

func (HWND) IsThemeDialogTextureEnabled

func (hWnd HWND) IsThemeDialogTextureEnabled() bool

IsThemeDialogTextureEnabled function.

func (HWND) IsTopLevelWindow

func (hWnd HWND) IsTopLevelWindow() bool

Allegedly undocumented Win32 function.

func (HWND) IsWindow

func (hWnd HWND) IsWindow() bool

IsWindow function.

func (HWND) IsWindowEnabled

func (hWnd HWND) IsWindowEnabled() bool

IsWindowEnabled function.

func (HWND) IsWindowVisible

func (hWnd HWND) IsWindowVisible() bool

IsWindowVisible function.

func (HWND) IsZoomed

func (hWnd HWND) IsZoomed() bool

IsZoomed function.

func (HWND) KillTimer

func (hWnd HWND) KillTimer(timerId uintptr)

KillTimer function.

func (HWND) LockWindowUpdate

func (hWnd HWND) LockWindowUpdate() error

LockWindowUpdate function.

func (HWND) LogicalToPhysicalPoint

func (hWnd HWND) LogicalToPhysicalPoint(pt *POINT)

LogicalToPhysicalPoint function.

func (HWND) MapDialogRect

func (hWnd HWND) MapDialogRect(rc *RECT)

MapDialogRect function.

func (HWND) MapWindowPoints

func (hWnd HWND) MapWindowPoints(hWndTo HWND, points []POINT) (int, int)

MapWindowPoints function.

Returns the number of pixels added horizontally and vertically to the passed points.

func (HWND) MenuItemFromPoint

func (hWnd HWND) MenuItemFromPoint(hMenu HMENU, pt POINT) (int, bool)

MenuItemFromPoint function.

func (HWND) MessageBox

func (hWnd HWND) MessageBox(text, caption string, uType co.MB) co.ID

MessageBox function.

func (HWND) MonitorFromWindow

func (hWnd HWND) MonitorFromWindow(flags co.MONITOR) HMONITOR

MonitorFromWindow function.

func (HWND) MoveWindow

func (hWnd HWND) MoveWindow(x, y, width, height int32, repaint bool)

MoveWindow function.

func (HWND) OpenClipboard

func (hWnd HWND) OpenClipboard() HCLIPBOARD

OpenClipboard function.

⚠️ You must defer HCLIPBOARD.CloseClipboard().

func (HWND) OpenThemeData

func (hWnd HWND) OpenThemeData(classNames string) (HTHEME, error)

OpenThemeData function.

⚠️ You must defer HTHEME.CloseThemeData().

func (HWND) PhysicalToLogicalPoint

func (hWnd HWND) PhysicalToLogicalPoint(pt *POINT)

PhysicalToLogicalPoint function.

func (HWND) PostMessage

func (hWnd HWND) PostMessage(msg co.WM, wParam WPARAM, lParam LPARAM)

PostMessage function.

func (HWND) RealChildWindowFromPoint

func (hWnd HWND) RealChildWindowFromPoint(
	parentClientCoords POINT) (HWND, bool)

RealChildWindowFromPoint function.

func (HWND) RealGetWindowClass

func (hWnd HWND) RealGetWindowClass() string

RealGetWindowClass function.

func (HWND) ReleaseDC

func (hWnd HWND) ReleaseDC(hdc HDC)

ReleaseDC function.

func (HWND) RemoveWindowSubclass

func (hWnd HWND) RemoveWindowSubclass(
	subclassProc uintptr, idSubclass uint32)

RemoveWindowSubclass function.

func (HWND) ScreenToClientPt

func (hWnd HWND) ScreenToClientPt(pt *POINT)

ScreenToClientPt function.

func (HWND) ScreenToClientRc

func (hWnd HWND) ScreenToClientRc(rc *RECT)

ScreenToClientRc function.

func (HWND) SendMessage

func (hWnd HWND) SendMessage(msg co.WM, wParam WPARAM, lParam LPARAM) uintptr

SendMessage function.

func (HWND) SendMessageTimeout

func (hWnd HWND) SendMessageTimeout(
	msg co.WM, wParam WPARAM, lParam LPARAM,
	flags co.SMTO, msTimeout int) (uintptr, error)

SendMessageTimeout function.

func (HWND) SetFocus

func (hWnd HWND) SetFocus() (HWND, error)

SetFocus function.

Returns a handle to the previously focused window.

func (HWND) SetForegroundWindow

func (hWnd HWND) SetForegroundWindow() bool

SetForegroundWindow function.

Returns true if the window was brought to the foreground.

func (HWND) SetLayeredWindowAttributes

func (hWnd HWND) SetLayeredWindowAttributes(
	transparencyColorKey COLORREF, alpha uint8, flags co.LWA)

SetLayeredWindowAttributes function.

func (HWND) SetMenu

func (hWnd HWND) SetMenu(hMenu HMENU)

SetMenu function.

func (HWND) SetParent

func (hWnd HWND) SetParent(hwndNewParent HWND) HWND

SetParent function.

Returns the handle of the previous parent window.

func (HWND) SetScrollInfo

func (hWnd HWND) SetScrollInfo(
	bar co.SB_TYPE, si *SCROLLINFO, redraw bool) int32

SetScrollInfo function.

Returns the current position of the scroll box.

func (HWND) SetScrollPos

func (hWnd HWND) SetScrollPos(bar co.SB_TYPE, pos int32, redraw bool) int32

SetScrollPos function.

func (HWND) SetScrollRange

func (hWnd HWND) SetScrollRange(
	bar co.SB_TYPE, minPos, maxPos int32, redraw bool) bool

SetScrollRange function.

func (HWND) SetTimer

func (hWnd HWND) SetTimer(msElapse int, timerId uintptr) uintptr

SetTimer function.

This method will create a timer that will post WM_TIMER messages, instead of running a callback.

The method returns the timer ID.

⚠️ You must call HWND.KillTimer() to stop the timer.

func (HWND) SetTimerCallback

func (hWnd HWND) SetTimerCallback(
	msElapse int, timerFunc func(timerId uintptr)) uintptr

Creates a timer with SetTimer, which runs the given callback instead of posting WM_TIMER messages.

The method returns the timer ID, which is also sent to the callback.

⚠️ You must call HWND.KillTimer() to stop the timer and free the allocated resources.

Example

var hWnd HWND // initialized somewhere

hWnd.SetTimerCallback(2000, func(timerId uintptr) {
	hWnd.KillTimer(timerId)
	println("This callback will run once.")
})

func (HWND) SetWindowDisplayAffinity

func (hWnd HWND) SetWindowDisplayAffinity(affinity co.WDA)

SetWindowDisplayAffinity function.

func (HWND) SetWindowLongPtr

func (hWnd HWND) SetWindowLongPtr(index co.GWLP, newLong uintptr) uintptr

SetWindowLongPtr function.

func (HWND) SetWindowPos

func (hWnd HWND) SetWindowPos(
	hwndInsertAfter HWND, x, y, cx, cy int32, flags co.SWP)

SetWindowPos function.

You can pass HWND or HWND_IA in hwndInsertAfter argument.

func (HWND) SetWindowRgn

func (hWnd HWND) SetWindowRgn(hRgn HRGN, redraw bool)

SetWindowRgn function.

func (HWND) SetWindowSubclass

func (hWnd HWND) SetWindowSubclass(
	subclassProc uintptr, idSubclass uint32, refData unsafe.Pointer)

SetWindowSubclass function.

func (HWND) SetWindowText

func (hWnd HWND) SetWindowText(text string)

SetWindowText function.

func (HWND) ShowCaret

func (hWnd HWND) ShowCaret()

ShowCaret function.

func (HWND) ShowWindow

func (hWnd HWND) ShowWindow(cmdShow co.SW) bool

ShowWindow function.

func (HWND) TaskDialog

func (hWnd HWND) TaskDialog(
	hInstance HINSTANCE,
	windowTitle, mainInstruction, content StrOpt,
	commonButtons co.TDCBF,
	icon co.TD_ICON) co.ID

TaskDialog function.

func (HWND) TranslateAccelerator

func (hWnd HWND) TranslateAccelerator(hAccel HACCEL, msg *MSG) error

TranslateAccelerator function.

func (HWND) UpdateWindow

func (hWnd HWND) UpdateWindow() bool

UpdateWindow function.

type ICONINFO

type ICONINFO struct {
	XHotspot uint32
	YHotspot uint32
	HbmMask  HBITMAP
	HbmColor HBITMAP
	// contains filtered or unexported fields
}

ICONINFO struct.

func (*ICONINFO) FIcon

func (ii *ICONINFO) FIcon() bool

func (*ICONINFO) SetFIcon

func (ii *ICONINFO) SetFIcon(val bool)

type ICONINFOEX

type ICONINFOEX struct {
	XHotspot uint32
	YHotspot uint32
	HbmMask  HBITMAP
	HbmColor HBITMAP
	WResID   uint16
	// contains filtered or unexported fields
}

ICONINFOEX struct.

⚠️ You must call SetCbSize() to initialize the struct.

func (*ICONINFOEX) FIcon

func (iix *ICONINFOEX) FIcon() bool

func (*ICONINFOEX) SetCbSize

func (iix *ICONINFOEX) SetCbSize()

func (*ICONINFOEX) SetFIcon

func (iix *ICONINFOEX) SetFIcon(val bool)

func (*ICONINFOEX) SetSzModName

func (iix *ICONINFOEX) SetSzModName(val string)

func (*ICONINFOEX) SetSzResName

func (iix *ICONINFOEX) SetSzResName(val string)

func (*ICONINFOEX) SzModName

func (iix *ICONINFOEX) SzModName() string

func (*ICONINFOEX) SzResName

func (iix *ICONINFOEX) SzResName() string

type IMAGELISTDRAWPARAMS

type IMAGELISTDRAWPARAMS struct {
	Himl         HIMAGELIST
	I            int32
	HdcDst       HDC
	X, Y, Cx, Cy int32
	XBitmap      int32
	YBitmap      int32
	RgbBk        COLORREF
	RgbFg        COLORREF
	FStyle       co.ILD
	DwRop        co.ROP
	FState       co.ILS
	Frame        uint32
	CrEffect     COLORREF
	// contains filtered or unexported fields
}

IMAGELISTDRAWPARAMS struct.

⚠️ You must call SetCbSize() to initialize the struct.

Example:

idp := &IMAGELISTDRAWPARAMS{}
idp.SetCbSize()

func (*IMAGELISTDRAWPARAMS) SetCbSize

func (idp *IMAGELISTDRAWPARAMS) SetCbSize()

type INITCOMMONCONTROLSEX

type INITCOMMONCONTROLSEX struct {
	DwICC co.ICC
	// contains filtered or unexported fields
}

INITCOMMONCONTROLSEX struct.

⚠️ You must call SetDwSize() to initialize the struct.

Example:

var icx INITCOMMONCONTROLSEX
icx.SetDwSize()

func (*INITCOMMONCONTROLSEX) SetDwSize

func (icx *INITCOMMONCONTROLSEX) SetDwSize()

type IconRes

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

Variant type for an icon resource identifier.

Example:

icoId := win.IconResIdi(co.IDI_HAND)

if idi, ok := icoId.Idi(); ok {
	println(idi)
}

func IconResIdi

func IconResIdi(idi co.IDI) IconRes

Creates a new IconRes variant with a co.IDI value.

func IconResInt

func IconResInt(id int) IconRes

Creates a new IconRes variant with an int value.

func IconResStr

func IconResStr(str string) IconRes

Creates a new IconRes variant with a string value.

func (*IconRes) Id

func (me *IconRes) Id() (int, bool)

func (*IconRes) Idi

func (me *IconRes) Idi() (co.IDI, bool)

func (*IconRes) Str

func (me *IconRes) Str() (string, bool)

type Ini

type Ini struct {
	Sections []IniSection // All sections of this .ini file.
	// contains filtered or unexported fields
}

High-level abstraction to a .ini file.

Contains a slice of sections, which can be freely modified.

Created with IniLoad().

func IniLoad

func IniLoad(filePath string) (*Ini, error)

Loads the sections and keys of an INI file.

func (*Ini) SaveToFile

func (me *Ini) SaveToFile(filePath string) error

Saves the contents to a .ini file.

func (*Ini) Section

func (me *Ini) Section(name string) (*IniSection, bool)

Returns the IniSection with the given name, if any.

func (*Ini) SourcePath

func (me *Ini) SourcePath() string

Returns the latest source path of the .ini file.

When IniLoad() is called, this path is stored. When Ini.SaveToFile() is called, this new path is stored.

This is useful when you load an .ini file, and you need to update it later. When you first open, you pass the file path; on subsequent saves, you just call Ini.SourcePath() to retrieve the path, instead of manually saving it somewhere.

Example

ini, _ := win.IniLoad("C:\\Temp\\foo.ini")

// modify ini...

ini.SaveToFile(ini.SourcePath())

func (*Ini) Value

func (me *Ini) Value(sectionName, valueName string) (*string, bool)

Returns the specific value, if existing.

Note that a pointer to the string is returned, so that the value can be directly modified.

Example

ini, _ := win.IniLoad("C:\\Temp\\foo.ini")

if val, ok := ini.Value("my section", "my value"); ok {
	fmt.Printf("Old value: %s\n", *val)
	*val = "new value"
}

type IniKey

type IniKey struct {
	Name  string // The name of this key.
	Value string // The value of this key.
}

A single key of an IniSection.

type IniSection

type IniSection struct {
	Name   string   // The name of this section.
	Values []IniKey // All values of this section.
}

A single section of an Ini.

Contains a slice of keys, which can be freely modified.

func (*IniSection) Value

func (me *IniSection) Value(name string) (*IniKey, bool)

Returns the IniKey with the given name, if any.

type LANGID

type LANGID uint16

Language and sublanguage identifier.

const (
	LANGID_SYSTEM_DEFAULT LANGID = LANGID((uint16(co.SUBLANG_SYS_DEFAULT) << 10) | uint16(co.LANG_NEUTRAL))
	LANGID_USER_DEFAULT   LANGID = LANGID((uint16(co.SUBLANG_DEFAULT) << 10) | uint16(co.LANG_NEUTRAL))
)

Predefined language identifier.

func MAKELANGID

func MAKELANGID(lang co.LANG, subLang co.SUBLANG) LANGID

MAKELANGID macro.

func (LANGID) Lang

func (lid LANGID) Lang() co.LANG

PRIMARYLANGID macro.

func (LANGID) SubLang

func (lid LANGID) SubLang() co.SUBLANG

SUBLANGID macro.

type LCID

type LCID uint32

Locale identifier.

const (
	LCID_SYSTEM_DEFAULT LCID = LCID((uint32(co.SORT_DEFAULT) << 16) | uint32(LANGID_SYSTEM_DEFAULT))
	LCID_USER_DEFAULT   LCID = LCID((uint32(co.SORT_DEFAULT) << 16) | uint32(LANGID_USER_DEFAULT))
)

Predefined locale identifier.

func MAKELCID

func MAKELCID(langId LANGID, sortId co.SORT) LCID

MAKELCID macro.

func (LCID) LangId

func (lcid LCID) LangId() LANGID

LANGIDFROMLCID macro.

func (LCID) SortId

func (lcid LCID) SortId() co.SORT

SORTIDFROMLCID macro.

type LITEM

type LITEM struct {
	Mask      co.LIF
	ILink     int32
	State     co.LIS
	StateMask co.LIS
	// contains filtered or unexported fields
}

LITEM struct.

func (*LITEM) SetSzID

func (li *LITEM) SetSzID(val string)

func (*LITEM) SetSzUrl

func (li *LITEM) SetSzUrl(val string)

func (*LITEM) SzID

func (li *LITEM) SzID() string

func (*LITEM) SzUrl

func (li *LITEM) SzUrl() string

type LOGBRUSH

type LOGBRUSH struct {
	LbStyle co.BRS
	LbColor COLORREF
	LbHatch uintptr // ULONG_PTR
}

LOGBRUSH struct.

type LOGFONT

type LOGFONT struct {
	LfHeight         int32
	LfWidth          int32
	LfEscapement     int32
	LfOrientation    int32
	LfWeight         co.FW
	LfItalic         uint8
	LfUnderline      uint8
	LfStrikeOut      uint8
	LfCharSet        uint8
	LfOutPrecision   uint8
	LfClipPrecision  uint8
	LfQuality        uint8
	LfPitchAndFamily uint8
	// contains filtered or unexported fields
}

LOGFONT struct.

func (*LOGFONT) LfFaceName

func (lf *LOGFONT) LfFaceName() string

func (*LOGFONT) SetLfFaceName

func (lf *LOGFONT) SetLfFaceName(val string)

type LOGPEN

type LOGPEN struct {
	LopnStyle co.PS
	LopnWidth POINT
	LopnColor COLORREF
}

LOGPEN struct.

type LPARAM

type LPARAM uintptr

Second message parameter.

func GetMessageExtraInfo

func GetMessageExtraInfo() LPARAM

GetMessageExtraInfo function.

func MAKELPARAM

func MAKELPARAM(lo, hi uint16) LPARAM

MAKELPARAM macro.

func SetMessageExtraInfo

func SetMessageExtraInfo(lp LPARAM) LPARAM

SetMessageExtraInfo function.

func (LPARAM) HiWord

func (lp LPARAM) HiWord() uint16

func (LPARAM) LoWord

func (lp LPARAM) LoWord() uint16

func (LPARAM) MakePoint

func (lp LPARAM) MakePoint() POINT

func (LPARAM) MakeSize

func (lp LPARAM) MakeSize() SIZE

type LVCOLUMN

type LVCOLUMN struct {
	Mask co.LVCF
	Fmt  co.LVCFMT_C
	Cx   int32

	ISubItem  int32
	IImage    int32
	IOrder    int32
	CxMin     int32
	CxDefault int32
	CxIdeal   int32
	// contains filtered or unexported fields
}

LVCOLUMN struct.

func (*LVCOLUMN) PszText

func (lvc *LVCOLUMN) PszText() []uint16

func (*LVCOLUMN) SetPszText

func (lvc *LVCOLUMN) SetPszText(val []uint16)

type LVFINDINFO

type LVFINDINFO struct {
	Flags  co.LVFI
	Psz    *uint16
	LParam LPARAM
	Pt     POINT
	// contains filtered or unexported fields
}

LVFINDINFO struct.

func (*LVFINDINFO) SetVkDirection

func (fi *LVFINDINFO) SetVkDirection(val co.VK)

func (*LVFINDINFO) VkDirection

func (fi *LVFINDINFO) VkDirection() co.VK

type LVHITTESTINFO

type LVHITTESTINFO struct {
	Pt       POINT // Coordinates relative to list view.
	Flags    co.LVHT
	IItem    int32 // -1 if no item.
	ISubItem int32
	IGroup   int32
}

LVHITTESTINFO struct.

type LVITEM

type LVITEM struct {
	Mask      co.LVIF
	IItem     int32
	ISubItem  int32
	State     co.LVIS
	StateMask co.LVIS

	IImage    int32
	LParam    LPARAM
	IIndent   int32
	IGroupId  co.LVI_GROUPID
	CColumns  uint32
	PuColumns *uint32
	PiColFmt  *co.LVCFMT_I
	IGroup    int32
	// contains filtered or unexported fields
}

LVITEM struct.

func (*LVITEM) PszText

func (lvi *LVITEM) PszText() []uint16

func (*LVITEM) SetPszText

func (lvi *LVITEM) SetPszText(val []uint16)

type LVITEMINDEX

type LVITEMINDEX struct {
	IItem  int32
	IGroup int32
}

LVITEMINDEX struct.

type MANAGEDAPPLICATION

type MANAGEDAPPLICATION struct {
	DwVersionHi uint32
	DwVersionLo uint32
	DwRevision  uint32
	GpoId       GUID

	ProductId GUID
	Language  LANGID

	DwPathType uint32
	// contains filtered or unexported fields
}

MANAGEDAPPLICATION struct.

func GetManagedApplications

func GetManagedApplications(category *GUID) ([]MANAGEDAPPLICATION, error)

GetManagedApplications function.

func (*MANAGEDAPPLICATION) BInstalled

func (ma *MANAGEDAPPLICATION) BInstalled() bool

func (*MANAGEDAPPLICATION) PszComments

func (ma *MANAGEDAPPLICATION) PszComments() string

func (*MANAGEDAPPLICATION) PszCompany

func (ma *MANAGEDAPPLICATION) PszCompany() string

func (*MANAGEDAPPLICATION) PszContact

func (ma *MANAGEDAPPLICATION) PszContact() string

func (*MANAGEDAPPLICATION) PszOwner

func (ma *MANAGEDAPPLICATION) PszOwner() string

func (*MANAGEDAPPLICATION) PszPackageName

func (ma *MANAGEDAPPLICATION) PszPackageName() string

func (*MANAGEDAPPLICATION) PszPolicyName

func (ma *MANAGEDAPPLICATION) PszPolicyName() string

func (*MANAGEDAPPLICATION) PszPublisher

func (ma *MANAGEDAPPLICATION) PszPublisher() string

func (*MANAGEDAPPLICATION) PszSupportUrl

func (ma *MANAGEDAPPLICATION) PszSupportUrl() string

type MARGINS

type MARGINS struct {
	CxLeftWidth    int32
	CxRightWidth   int32
	CyTopHeight    int32
	CyBottomHeight int32
}

MARGINS struct.

type MDINEXTMENU

type MDINEXTMENU struct {
	HmenuIn   HMENU
	HmenuNext HMENU
	HwndNext  HWND
}

MDINEXTMENU struct.

type MENUGETOBJECTINFO struct {
	DwFlags co.MNGOF
	UPos    uint32
	Hmenu   HMENU
	Riid    uintptr // PVOID
	PvObj   uintptr // PVOID
}

MENUGETOBJECTINFO struct.

type MENUINFO struct {
	FMask           co.MIM
	DwStyle         co.MNS
	CyMax           uint32
	HbrBack         HBRUSH
	DwContextHelpID uint32
	DwMenuData      uintptr // ULONG_PTR
	// contains filtered or unexported fields
}

MENUINFO struct.

⚠️ You must call SetCbSize() to initialize the struct.

func (mi *MENUINFO) SetCbSize()
type MENUITEMINFO struct {
	FMask         co.MIIM
	FType         co.MFT
	FState        co.MFS
	WId           uint32
	HSubMenu      HMENU
	HBmpChecked   HBITMAP
	HBmpUnchecked HBITMAP
	DwItemData    uintptr // ULONG_PTR
	DwTypeData    *uint16 // content changes according to fType
	Cch           uint32
	HBmpItem      HBITMAP
	// contains filtered or unexported fields
}

MENUITEMINFO struct.

⚠️ You must call SetCbSize() to initialize the struct.

func (mii *MENUITEMINFO) SetCbSize()

type MINMAXINFO

type MINMAXINFO struct {
	PtMaxSize      POINT
	PtMaxPosition  POINT
	PtMinTrackSize POINT
	PtMaxTrackSize POINT
	// contains filtered or unexported fields
}

MINMAXINFO struct.

type MODULEENTRY32

type MODULEENTRY32 struct {
	Th32ModuleID  uint32
	Th32ProcessID uint32
	GlblcntUsage  uint32
	ProccntUsage  uint32
	ModBaseAddr   uintptr
	ModBaseSize   uint32
	HModule       HINSTANCE
	// contains filtered or unexported fields
}

MODULEENTRY32 struct.

⚠️ You must call SetDwSize() to initialize the struct.

func (*MODULEENTRY32) SetDwSize

func (me *MODULEENTRY32) SetDwSize()

func (*MODULEENTRY32) SetSzExePath

func (me *MODULEENTRY32) SetSzExePath(val string)

func (*MODULEENTRY32) SetSzModule

func (me *MODULEENTRY32) SetSzModule(val string)

func (*MODULEENTRY32) SzExePath

func (me *MODULEENTRY32) SzExePath() string

func (*MODULEENTRY32) SzModule

func (me *MODULEENTRY32) SzModule() string

type MONITORINFOEX

type MONITORINFOEX struct {
	RcMonitor RECT
	RcWork    RECT
	DwFlags   co.MONITORINFOF
	// contains filtered or unexported fields
}

MONITORINFOEX struct.

⚠️ You must call SetCbSize() to initialize the struct.

func (*MONITORINFOEX) SetCbSize

func (mi *MONITORINFOEX) SetCbSize()

func (*MONITORINFOEX) SetSzDevice

func (dtf *MONITORINFOEX) SetSzDevice(val string)

func (*MONITORINFOEX) SzDevice

func (dtf *MONITORINFOEX) SzDevice() string

type MSG

type MSG struct {
	HWnd   HWND
	Msg    uint32
	WParam WPARAM
	LParam LPARAM
	Time   uint32
	Pt     POINT
}

MSG struct.

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

Variant type for a menu item identifier, which can be specified by command ID or zero-based position.

Example:

item := win.MenuItemPos(2)

if pos, ok := item.Pos(); ok {
	println(pos)
}
func MenuItemCmd(cmdId int) MenuItem

Creates a new MenuItem variant with a command ID.

func MenuItemPos(pos int) MenuItem

Creates a new MenuItem variant with a zero-based item index.

func (me *MenuItem) Cmd() (int, bool)
func (me *MenuItem) Flag() co.MF
func (me *MenuItem) Pos() (int, bool)

type NCCALCSIZE_PARAMS

type NCCALCSIZE_PARAMS struct {
	Rgrc  [3]RECT
	Lppos *WINDOWPOS
}

NCCALCSIZE_PARAMS struct.

type NMBCDROPDOWN

type NMBCDROPDOWN struct {
	Hdr      NMHDR
	RcButton RECT
}

NMBCDROPDOWN struct.

type NMBCHOTITEM

type NMBCHOTITEM struct {
	Hdr     NMHDR
	DwFlags co.HICF
}

NMBCHOTITEM struct.

type NMCHAR

type NMCHAR struct {
	Hdr        NMHDR
	Ch         uint32
	DwItemPrev uint32
	DwItemNext uint32
}

NMCHAR struct.

type NMCUSTOMDRAW

type NMCUSTOMDRAW struct {
	Hdr         NMHDR
	DwDrawStage co.CDDS
	Hdc         HDC
	Rc          RECT
	DwItemSpec  uintptr // DWORD_PTR
	UItemState  co.CDIS
	LItemlParam LPARAM
}

NMCUSTOMDRAW struct;

type NMDATETIMECHANGE

type NMDATETIMECHANGE struct {
	Nmhdr   NMHDR
	DwFlags co.GDT
	St      SYSTEMTIME
}

NMDATETIMECHANGE struct.

type NMDATETIMEFORMAT

type NMDATETIMEFORMAT struct {
	Nmhdr      NMHDR
	PszFormat  *uint16
	St         SYSTEMTIME
	PszDisplay *uint16
	// contains filtered or unexported fields
}

NMDATETIMEFORMAT struct.

func (*NMDATETIMEFORMAT) SetSzDisplay

func (dtf *NMDATETIMEFORMAT) SetSzDisplay(val string)

func (*NMDATETIMEFORMAT) SzDisplay

func (dtf *NMDATETIMEFORMAT) SzDisplay() string

type NMDATETIMEFORMATQUERY

type NMDATETIMEFORMATQUERY struct {
	Nmhdr     NMHDR
	PszFormat *uint16
	SzMax     SIZE
}

NMDATETIMEFORMATQUERY struct.

type NMDATETIMESTRING

type NMDATETIMESTRING struct {
	Nmhdr         NMHDR
	PszUserString *uint16
	St            SYSTEMTIME
	DwFlags       co.GDT
}

NMDATETIMESTRING struct.

type NMDATETIMEWMKEYDOWN

type NMDATETIMEWMKEYDOWN struct {
	Nmhdr NMHDR

	PszFormat *uint16
	St        SYSTEMTIME
	// contains filtered or unexported fields
}

NMDATETIMEWMKEYDOWN struct.

func (*NMDATETIMEWMKEYDOWN) NVirtKey

func (dtk *NMDATETIMEWMKEYDOWN) NVirtKey() co.VK

func (*NMDATETIMEWMKEYDOWN) SetNVirtKey

func (dtk *NMDATETIMEWMKEYDOWN) SetNVirtKey(val co.VK)

type NMDAYSTATE

type NMDAYSTATE struct {
	Nmhdr       NMHDR
	StStart     SYSTEMTIME
	CDayState   int32
	PrgDayState *uint32 // *MONTHDAYSTATE
}

NMDAYSTATE struct.

type NMHDR

type NMHDR struct {
	HWndFrom HWND
	IdFrom   uintptr // UINT_PTR, actually it's a simple control ID
	Code     uint32  // in fact it should be int32
}

NMHDR struct.

type NMITEMACTIVATE

type NMITEMACTIVATE struct {
	Hdr       NMHDR
	IItem     int32
	ISubItem  int32
	UNewState co.LVIS
	UOldState co.LVIS
	UChanged  co.LVIF
	PtAction  POINT
	LParam    LPARAM
	UKeyFlags co.LVKF
}

NMITEMACTIVATE struct.

type NMKEY

type NMKEY struct {
	Hdr NMHDR
	// contains filtered or unexported fields
}

NMKEY struct.

func (*NMKEY) ContextCode

func (nmk *NMKEY) ContextCode() bool

func (*NMKEY) IsExtendedKey

func (nmk *NMKEY) IsExtendedKey() bool

func (*NMKEY) IsKeyDownBeforeSend

func (nmk *NMKEY) IsKeyDownBeforeSend() bool

func (*NMKEY) NVKey

func (nmk *NMKEY) NVKey() co.VK

func (*NMKEY) ScanCode

func (nmk *NMKEY) ScanCode() uint8

func (*NMKEY) SetContextCode

func (nmk *NMKEY) SetContextCode(val bool)

func (*NMKEY) SetIsExtendedKey

func (nmk *NMKEY) SetIsExtendedKey(val bool)

func (*NMKEY) SetIsKeyDownBeforeSend

func (nmk *NMKEY) SetIsKeyDownBeforeSend(val bool)

func (*NMKEY) SetNVKey

func (nmk *NMKEY) SetNVKey(val co.VK)

func (*NMKEY) SetScanCode

func (nmk *NMKEY) SetScanCode(val uint8)

func (*NMKEY) SetTransitionState

func (nmk *NMKEY) SetTransitionState(val bool)

func (*NMKEY) TransitionState

func (nmk *NMKEY) TransitionState() bool
type NMLINK struct {
	Hdr  NMHDR
	Item LITEM
}

NMLINK struct.

type NMLISTVIEW

type NMLISTVIEW struct {
	Hdr       NMHDR
	IItem     int32
	ISubItem  int32
	UNewState co.LVIS
	UOldState co.LVIS
	UChanged  co.LVIF
	PtAction  POINT
	LParam    LPARAM
}

NMLISTVIEW struct.

type NMLVCACHEHINT

type NMLVCACHEHINT struct {
	Hdr   NMHDR
	IFrom int32
	ITo   int32
}

NMLVCACHEHINT struct.

type NMLVCUSTOMDRAW

type NMLVCUSTOMDRAW struct {
	Nmcd        NMCUSTOMDRAW
	ClrText     COLORREF
	ClrTextBk   COLORREF
	ISubItem    int32
	DwItemType  co.LVCDI
	ClrFace     COLORREF
	IIconEffect int32
	IIconPhase  int32

	RcText RECT
	UAlign co.LVGA_HEADER
	// contains filtered or unexported fields
}

NMLVCUSTOMDRAW struct.

func (*NMLVCUSTOMDRAW) PartStateId

func (lcd *NMLVCUSTOMDRAW) PartStateId() co.VS

func (*NMLVCUSTOMDRAW) SetPartStateId

func (lcd *NMLVCUSTOMDRAW) SetPartStateId(val co.VS)

type NMLVDISPINFO

type NMLVDISPINFO struct {
	Hdr  NMHDR
	Item LVITEM
}

NMLVDISPINFO struct.

type NMLVEMPTYMARKUP

type NMLVEMPTYMARKUP struct {
	Hdr     NMHDR
	DwFlags co.EMF
	// contains filtered or unexported fields
}

NMLVEMPTYMARKUP struct.

func (*NMLVEMPTYMARKUP) SetSzMarkup

func (lve *NMLVEMPTYMARKUP) SetSzMarkup(val string)

func (*NMLVEMPTYMARKUP) SzMarkup

func (lve *NMLVEMPTYMARKUP) SzMarkup() string

type NMLVFINDITEM

type NMLVFINDITEM struct {
	Hdr    NMHDR
	IStart int32
	Lvfi   LVFINDINFO
}

NMLVFINDITEM struct.

type NMLVGETINFOTIP

type NMLVGETINFOTIP struct {
	Hdr     NMHDR
	DwFlags co.LVGIT

	IItem    int32
	ISubItem int32
	LParam   LPARAM
	// contains filtered or unexported fields
}

NMLVGETINFOTIP struct.

func (*NMLVGETINFOTIP) PszText

func (git *NMLVGETINFOTIP) PszText() []uint16

func (*NMLVGETINFOTIP) SetPszText

func (git *NMLVGETINFOTIP) SetPszText(val []uint16)

type NMLVKEYDOWN

type NMLVKEYDOWN struct {
	Hdr   NMHDR
	WVKey co.VK
	Flags uint32
}

NMLVKEYDOWN struct.

type NMLVLINK struct {
	Hdr      NMHDR
	Link     LITEM
	IItem    int32
	ISubItem int32
}

NMLVLINK struct.

type NMLVODSTATECHANGE

type NMLVODSTATECHANGE struct {
	Hdr       NMHDR
	IFrom     int32
	ITo       int32
	UNewState co.LVIS
	UOldState co.LVIS
}

NMLVODSTATECHANGE struct.

type NMLVSCROLL

type NMLVSCROLL struct {
	Hdr    NMHDR
	Dx, Dy int32
}

NMLVSCROLL struct.

type NMMOUSE

type NMMOUSE struct {
	Hdr        NMHDR
	DwItemSpec uintptr // DWORD_PTR
	DwItemData uintptr // DWORD_PTR
	Pt         POINT
	DwHitInfo  LPARAM
}

NMMOUSE struct.

type NMOBJECTNOTIFY

type NMOBJECTNOTIFY struct {
	Hdr     NMHDR
	IItem   int32
	Piid    *GUID
	PObject uintptr // *IUnknown
	HResult errco.ERROR
	DwFlags uint32
}

NMOBJECTNOTIFY struct.

type NMSELCHANGE

type NMSELCHANGE struct {
	Nmhdr      NMHDR
	StSelStart SYSTEMTIME
	StSelEnd   SYSTEMTIME
}

NMSELCHANGE struct.

type NMTBCUSTOMDRAW

type NMTBCUSTOMDRAW struct {
	Nmcd                 NMCUSTOMDRAW
	HbrMonoDither        HBRUSH
	HbrLines             HBRUSH
	HpenLines            HPEN
	ClrText              COLORREF
	ClrMark              COLORREF
	ClrTextHighlight     COLORREF
	ClrBtnFace           COLORREF
	ClrBtnHighlight      COLORREF
	ClrHighlightHotTrack COLORREF
	RcText               RECT
	NStringBkMode        co.BKMODE
	NHLStringBkMode      co.BKMODE
	IListGap             int32
}

NMTBCUSTOMDRAW struct.

type NMTBDISPINFO

type NMTBDISPINFO struct {
	Hdr       NMHDR
	DwMask    co.TBNF
	IdCommand int32
	LParam    LPARAM
	IImage    int32
	// contains filtered or unexported fields
}

NMTBDISPINFO struct.

func (*NMTBDISPINFO) PszText

func (tdi *NMTBDISPINFO) PszText() []uint16

func (*NMTBDISPINFO) SetPszText

func (tdi *NMTBDISPINFO) SetPszText(val []uint16)

type NMTBDUPACCELERATOR

type NMTBDUPACCELERATOR struct {
	Hdr NMHDR
	Ch  uint32
	// contains filtered or unexported fields
}

NMTBDUPACCELERATOR struct.

func (*NMTBDUPACCELERATOR) FDup

func (da *NMTBDUPACCELERATOR) FDup() bool

func (*NMTBDUPACCELERATOR) SetFDup

func (da *NMTBDUPACCELERATOR) SetFDup(val bool)

type NMTBGETINFOTIP

type NMTBGETINFOTIP struct {
	Hdr NMHDR

	IItem  int32
	LParam LPARAM
	// contains filtered or unexported fields
}

NMTBGETINFOTIP struct.

func (*NMTBGETINFOTIP) PszText

func (git *NMTBGETINFOTIP) PszText() []uint16

func (*NMTBGETINFOTIP) SetPszText

func (git *NMTBGETINFOTIP) SetPszText(val []uint16)

type NMTBHOTITEM

type NMTBHOTITEM struct {
	Hdr     NMHDR
	IdOld   int32
	IdNew   int32
	DwFlags co.HICF
}

NMTBHOTITEM struct.

type NMTBRESTORE

type NMTBRESTORE struct {
	Hdr              NMHDR
	PData            *uint32
	PCurrent         *uint32
	CbData           uint32
	IItem            int32
	CButtons         int32
	CbBytesPerRecord int32
	TbButton         TBBUTTON
}

NMTBRESTORE struct.

type NMTBSAVE

type NMTBSAVE struct {
	Hdr      NMHDR
	PData    *uint32
	PCurrent *uint32
	CbData   uint32
	IItem    int32
	CButtons int32
	TbButton TBBUTTON
}

NMTBSAVE struct.

type NMTBWRAPACCELERATOR

type NMTBWRAPACCELERATOR struct {
	Hdr     NMHDR
	Ch      uint32
	IButton int32
}

NMTBWRAPACCELERATOR struct.

type NMTBWRAPHOTITEM

type NMTBWRAPHOTITEM struct {
	Hdr     NMHDR
	IStart  int32
	IDir    int32
	NReason co.HICF
}

NMTBWRAPHOTITEM struct.

type NMTOOLBAR

type NMTOOLBAR struct {
	Hdr      NMHDR
	IItem    int32
	TbButton TBBUTTON

	RcButton RECT
	// contains filtered or unexported fields
}

NMTOOLBAR struct.

func (*NMTOOLBAR) PszText

func (git *NMTOOLBAR) PszText() []uint16

func (*NMTOOLBAR) SetPszText

func (git *NMTOOLBAR) SetPszText(val []uint16)

type NMTOOLTIPSCREATED

type NMTOOLTIPSCREATED struct {
	Hdr          NMHDR
	HwndToolTips HWND
}

NMTOOLTIPSCREATED struct.

type NMTRBTHUMBPOSCHANGING

type NMTRBTHUMBPOSCHANGING struct {
	Hdr     NMHDR
	DwPos   uint32
	NReason co.TB_REQ
}

NMTRBTHUMBPOSCHANGING struct.

type NMTREEVIEW

type NMTREEVIEW struct {
	Hdr     NMHDR
	Action  uint32 // co.TVE | co.TVC
	ItemOld TVITEM
	ItemNew TVITEM
	PtDrag  POINT
}

NMTREEVIEW struct.

type NMTVASYNCDRAW

type NMTVASYNCDRAW struct {
	Hdr            NMHDR
	Pimldp         *IMAGELISTDRAWPARAMS
	Hr             errco.ERROR // HRESULT
	Hitem          HTREEITEM
	LParam         LPARAM
	DwRetFlags     co.ADRF
	IRetImageIndex int32
}

NMTVASYNCDRAW struct.

type NMTVCUSTOMDRAW

type NMTVCUSTOMDRAW struct {
	Nmcd      NMCUSTOMDRAW
	ClrText   COLORREF
	ClrTextBk COLORREF
	ILevel    int32
}

NMTVCUSTOMDRAW struct.

type NMTVDISPINFO

type NMTVDISPINFO struct {
	Hdr  NMHDR
	Item TVITEM
}

NMTVDISPINFO struct.

type NMTVGETINFOTIP

type NMTVGETINFOTIP struct {
	Hdr NMHDR

	HItem  HTREEITEM
	LParam LPARAM
	// contains filtered or unexported fields
}

NMTVGETINFOTIP struct.

func (*NMTVGETINFOTIP) PszText

func (git *NMTVGETINFOTIP) PszText() []uint16

func (*NMTVGETINFOTIP) SetPszText

func (git *NMTVGETINFOTIP) SetPszText(val []uint16)

type NMTVITEMCHANGE

type NMTVITEMCHANGE struct {
	Hdr       NMHDR
	UChanged  co.TVIF
	HItem     HTREEITEM
	UStateNew co.TVIS
	UStateOld co.TVIS
	LParam    LPARAM
}

NMTVITEMCHANGE struct.

type NMTVKEYDOWN

type NMTVKEYDOWN struct {
	Hdr   NMHDR
	WVKey co.VK
	Flags uint32
}

NMTVKEYDOWN struct.

type NMVIEWCHANGE

type NMVIEWCHANGE struct {
	Nmhdr     NMHDR
	DwOldView co.MCMV
	DwNewView co.MCMV
}

NMVIEWCHANGE struct.

type NONCLIENTMETRICS

type NONCLIENTMETRICS struct {
	IBorderWidth       int32
	IScrollWidth       int32
	IScrollHeight      int32
	ICaptionWidth      int32
	ICaptionHeight     int32
	LfCaptionFont      LOGFONT
	ISmCaptionWidth    int32
	ISmCaptionHeight   int32
	LfSmCaptionFont    LOGFONT
	IMenuWidth         int32
	IMenuHeight        int32
	LfMenuFont         LOGFONT
	LfStatusFont       LOGFONT
	LfMessageFont      LOGFONT
	IPaddedBorderWidth int32
	// contains filtered or unexported fields
}

NONCLIENTMETRICS struct.

⚠️ You must call SetCbSize() to initialize the struct.

func (*NONCLIENTMETRICS) CbSize

func (ncm *NONCLIENTMETRICS) CbSize() uint32

func (*NONCLIENTMETRICS) SetCbSize

func (ncm *NONCLIENTMETRICS) SetCbSize()

type NOTIFYICONDATA

type NOTIFYICONDATA struct {
	Hwnd             HWND
	UID              uint32
	UFlags           co.NIF
	UCallbackMessage co.WM
	HIcon            HICON

	DwState     co.NIS
	DwStateMask co.NIS

	UTimeoutVersion uint32 // union

	DwInfoFlags  co.NIIF
	GuidItem     GUID
	HBalloonIcon HICON
	// contains filtered or unexported fields
}

NOTIFYICONDATA struct.

⚠️ You must call SetCbSize() to initialize the struct.

Example

nic := &NOTIFYICONDATA{}
nic.SetCbSize()

func (*NOTIFYICONDATA) SetCbSize

func (nid *NOTIFYICONDATA) SetCbSize()

func (*NOTIFYICONDATA) SetSzInfo

func (nid *NOTIFYICONDATA) SetSzInfo(val string)

func (*NOTIFYICONDATA) SetSzInfoTitle

func (nid *NOTIFYICONDATA) SetSzInfoTitle(val string)

func (*NOTIFYICONDATA) SetSzTip

func (nid *NOTIFYICONDATA) SetSzTip(val string)

func (*NOTIFYICONDATA) SzInfo

func (nid *NOTIFYICONDATA) SzInfo() string

func (*NOTIFYICONDATA) SzInfoTitle

func (nid *NOTIFYICONDATA) SzInfoTitle() string

func (*NOTIFYICONDATA) SzTip

func (nid *NOTIFYICONDATA) SzTip() string

type NumInf

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

Variant type for a number which can be INFINITE (defined in Windows headers as -1).

Example:

num := win.NumInfNumeric(100)

inf := win.NumInfInfinite()

func NumInfInfinite

func NumInfInfinite() NumInf

Creates a new NumInf variant with an INFINITE value.

func NumInfNumeric

func NumInfNumeric(n int) NumInf

Creates a new NumInf variant with a numeric value.

func (*NumInf) IsInfinite

func (me *NumInf) IsInfinite() bool

Returns true if the current value is INFINITE.

func (*NumInf) IsNumeric

func (me *NumInf) IsNumeric() bool

Returns true if the current value is numeric (not INFINITE).

func (*NumInf) Numeric

func (me *NumInf) Numeric() (int, bool)

If the current value is numeric, returns the number and true; otherwise returns zero and false.

Example:

num := win.NumInfNumeric(100)

if val, ok := num.Numeric(); ok {
	println(val)
}

func (*NumInf) Raw

func (me *NumInf) Raw() uintptr

Converts the internal value to uintptr.

type OSVERSIONINFOEX

type OSVERSIONINFOEX struct {
	DwMajorVersion uint32
	DwMinorVersion uint32
	DwBuildNumber  uint32
	DWPlatformId   uint32

	WServicePackMajor uint16
	WServicePackMinor uint16
	WSuiteMask        co.VER_SUITE
	WProductType      uint8
	// contains filtered or unexported fields
}

OSVERSIONINFOEX struct.

⚠️ You must call SetDwOsVersionInfoSize() to initialize the struct.

func (*OSVERSIONINFOEX) SetDwOsVersionInfoSize

func (osv *OSVERSIONINFOEX) SetDwOsVersionInfoSize()

func (*OSVERSIONINFOEX) SetSzCSDVersion

func (osv *OSVERSIONINFOEX) SetSzCSDVersion(val string)

func (*OSVERSIONINFOEX) SzCSDVersion

func (osv *OSVERSIONINFOEX) SzCSDVersion() string

type OVERLAPPED

type OVERLAPPED struct {
	Internal     uintptr
	InternalHigh uintptr
	Pointer      uintptr
	HEvent       HEVENT
}

OVERLAPPED struct.

type PAINTSTRUCT

type PAINTSTRUCT struct {
	Hdc HDC

	RcPaint RECT
	// contains filtered or unexported fields
}

PAINTSTRUCT struct.

func (*PAINTSTRUCT) FErase

func (ps *PAINTSTRUCT) FErase() bool

func (*PAINTSTRUCT) SetFErase

func (ps *PAINTSTRUCT) SetFErase(val bool)

type POINT

type POINT struct {
	X, Y int32
}

POINT struct.

Basic point structure, with x and y coordinates.

func GetCursorPos

func GetCursorPos() POINT

GetCursorPos function.

func GetMessagePos

func GetMessagePos() POINT

GetMessagePos function.

func GetPhysicalCursorPos

func GetPhysicalCursorPos() POINT

GetPhysicalCursorPos function.

type POWERBROADCAST_SETTING

type POWERBROADCAST_SETTING struct {
	PowerSetting GUID
	DataLength   uint32
	// contains filtered or unexported fields
}

POWERBROADCAST_SETTING struct.

func (*POWERBROADCAST_SETTING) Data

func (pbs *POWERBROADCAST_SETTING) Data(i int) *uint8

type PROCESSENTRY32

type PROCESSENTRY32 struct {
	Th32ProcessID uint32

	CntThreads          uint32
	Th32ParentProcessID uint32
	PcPriClassBase      int32
	// contains filtered or unexported fields
}

PROCESSENTRY32 struct.

⚠️ You must call SetDwSize() to initialize the struct.

func (*PROCESSENTRY32) SetDwSize

func (pe *PROCESSENTRY32) SetDwSize()

func (*PROCESSENTRY32) SetSzExeFile

func (me *PROCESSENTRY32) SetSzExeFile(val string)

func (*PROCESSENTRY32) SzExeFile

func (me *PROCESSENTRY32) SzExeFile() string

type PROCESS_INFORMATION

type PROCESS_INFORMATION struct {
	HProcess    HPROCESS
	HThread     HTHREAD
	DwProcessId uint32
	DwThreadId  uint32
}

PROCESS_INFORMATION struct.

type RECT

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

RECT struct.

Basic rectangle structure, with left, top, right and bottom values.

func GetCaretPos

func GetCaretPos() RECT

GetCaretPos function.

type RGBQUAD

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

RGBQUAD struct.

func (*RGBQUAD) Blue

func (rq *RGBQUAD) Blue() uint8

func (*RGBQUAD) Green

func (rq *RGBQUAD) Green() uint8

func (*RGBQUAD) Red

func (rq *RGBQUAD) Red() uint8

func (*RGBQUAD) SetBlue

func (rq *RGBQUAD) SetBlue(val uint8)

func (*RGBQUAD) SetGreen

func (rq *RGBQUAD) SetGreen(val uint8)

func (*RGBQUAD) SetRed

func (rq *RGBQUAD) SetRed(val uint8)

func (*RGBQUAD) ToColorref

func (rq *RGBQUAD) ToColorref() COLORREF

type RegVal

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

Variant type for a Registry value.

Example

regVal := RegValSz("Some text")

if val, ok := regVal.Sz(); ok {
	println(val)
}

func RegValBinary

func RegValBinary(data []byte) RegVal

Creates a new RegVal variant with a co.REG_BINARY value.

func RegValDword

func RegValDword(n uint32) RegVal

Creates a new RegVal variant with a co.REG_DWORD value.

func RegValExpandSz

func RegValExpandSz(s string) RegVal

Creates a new RegVal variant with a co.REG_EXPAND_SZ value.

When the value is retrieved, the environment variables should be expanded with ExpandEnvironmentStrings function.

func RegValNone

func RegValNone() RegVal

Creates a new RegVal variant with a co.REG_NONE value.

func RegValQword

func RegValQword(n uint64) RegVal

Creates a new RegVal variant with a co.REG_QWORD value.

func RegValSz

func RegValSz(s string) RegVal

Creates a new RegVal variant with a co.REG_SZ value.

func (*RegVal) Binary

func (me *RegVal) Binary() ([]byte, bool)

If the current value is co.REG_BINARY, returns it and true; otherwise nil and false.

Example:

regVal := win.RegValBinary([]byte{0x10, 0x44})

if val, ok := regVal.Binary(); ok {
	println(len(val))
}

func (*RegVal) Dword

func (me *RegVal) Dword() (uint32, bool)

If the current value is co.REG_DWORD, returns it and true; otherwise 0 and false.

Example:

regVal := RegValDword(0x8000_1001)

if val, ok := regVal.Dword(); ok {
	println(val)
}

func (*RegVal) ExpandSz

func (me *RegVal) ExpandSz() (string, bool)

If the current value is co.REG_EXPAND_SZ, returns it and true; otherwise "" and false.

Environment variables can be expanded with ExpandEnvironmentStrings function.

Example:

regVal := RegValExpandSz("Some text")

if val, ok := regVal.ExpandSz(); ok {
	println(ExpandEnvironmentStrings(val))
}

func (*RegVal) IsNone

func (me *RegVal) IsNone() bool

Returns true if current value is co.REG_NONE.

func (*RegVal) Qword

func (me *RegVal) Qword() (uint64, bool)

If the current value is co.REG_QWORD, returns it and true; otherwise 0 and false.

Example:

regVal := RegValQword(0x8000_3303_0000_1001)

if val, ok := regVal.Qword(); ok {
	println(val)
}

func (*RegVal) Sz

func (me *RegVal) Sz() (string, bool)

If the current value is co.REG_SZ, returns it and true; otherwise "" and false.

Example:

regVal := RegValSz("Some text")

if val, ok := regVal.Sz(); ok {
	println(val)
}

func (*RegVal) Type

func (me *RegVal) Type() co.REG

Returns the stored co.REG type.

type ResId

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

Variant type for a resource identifier.

Example:

resId := win.ResIdInt(0x400)

if id, ok := resId.Id(); ok {
	println(id)
}

func ResIdInt

func ResIdInt(id int) ResId

Creates a new ResId variant with an int value.

func ResIdStr

func ResIdStr(str string) ResId

Creates a new ResId variant with a string value.

func (*ResId) Id

func (me *ResId) Id() (int, bool)

func (*ResId) Str

func (me *ResId) Str() (string, bool)

type ResourceInfo

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

High-level abstraction to an embedded resource, which can be loaded from an executable of DLL file.

Created with ResourceInfoLoad().

func ResourceInfoLoad

func ResourceInfoLoad(exePath string) (*ResourceInfo, error)

Reads and stores an embedded resource from an executable or DLL file.

Example

resNfo, _ := win.ResourceInfoLoad(win.HINSTANCE(0).GetModuleFileName())
verNfo, _ := resNfo.FixedFileInfo()
vMaj, vMin, vPat, _ := verNfo.ProductVersion() // like 1.0.0

blocks := resNfo.Blocks() // each block contains one language
productName, _ := blocks[0].ProductName()
companyName, _ := blocks[0].CompanyName()

func (*ResourceInfo) Blocks

func (me *ResourceInfo) Blocks() []ResourceInfoBlock

Returns the string information blocks, one per language and code page, which contain several strings.

func (*ResourceInfo) FixedFileInfo

func (me *ResourceInfo) FixedFileInfo() (*VS_FIXEDFILEINFO, bool)

Returns the VS_FIXEDFILEINFO struct, which contains version information.

func (*ResourceInfo) ProductVersion

func (me *ResourceInfo) ProductVersion() (major, minor, patch, build uint16)

Calls ResourceInfo.FixedFileInfo() and automatically retrieves the product version, or all zeros if not available.

type ResourceInfoBlock

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

A block of information retrieved by ResourceInfo.

func (*ResourceInfoBlock) CodePage

func (me *ResourceInfoBlock) CodePage() co.CP

func (*ResourceInfoBlock) Comments

func (me *ResourceInfoBlock) Comments() (string, bool)

func (*ResourceInfoBlock) CompanyName

func (me *ResourceInfoBlock) CompanyName() (string, bool)

func (*ResourceInfoBlock) FileDescription

func (me *ResourceInfoBlock) FileDescription() (string, bool)

func (*ResourceInfoBlock) FileVersion

func (me *ResourceInfoBlock) FileVersion() (string, bool)

func (*ResourceInfoBlock) InternalName

func (me *ResourceInfoBlock) InternalName() (string, bool)

func (*ResourceInfoBlock) LangId

func (me *ResourceInfoBlock) LangId() LANGID

func (*ResourceInfoBlock) LegalCopyright

func (me *ResourceInfoBlock) LegalCopyright() (string, bool)

func (*ResourceInfoBlock) LegalTrademarks

func (me *ResourceInfoBlock) LegalTrademarks() (string, bool)

func (*ResourceInfoBlock) OriginalFilename

func (me *ResourceInfoBlock) OriginalFilename() (string, bool)

func (*ResourceInfoBlock) PrivateBuild

func (me *ResourceInfoBlock) PrivateBuild() (string, bool)

func (*ResourceInfoBlock) ProductName

func (me *ResourceInfoBlock) ProductName() (string, bool)

func (*ResourceInfoBlock) ProductVersion

func (me *ResourceInfoBlock) ProductVersion() (string, bool)

func (*ResourceInfoBlock) SpecialBuild

func (me *ResourceInfoBlock) SpecialBuild() (string, bool)

type RsrcType

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

Variant type for a resource type.

Example:

rsrcTy := win.RsrcTypeRt(co.RT_ACCELERATOR)

func RsrcTypeRt

func RsrcTypeRt(rt co.RT) RsrcType

Creates a new RsrcType variant with a co.RT value.

func RsrcTypeStr

func RsrcTypeStr(str string) RsrcType

Creates a new RsrcType variant with a string value.

func (*RsrcType) Rt

func (me *RsrcType) Rt() (co.RT, bool)

func (*RsrcType) Str

func (me *RsrcType) Str() (string, bool)

type SCROLLINFO

type SCROLLINFO struct {
	FMask     co.SIF
	NMin      uint32
	NMax      uint32
	NPage     uint32
	NPos      int32
	NTrackPos int32
	// contains filtered or unexported fields
}

SCROLLINFO struct.

⚠️ You must call SetCbSize() to initialize the struct.

func (*SCROLLINFO) SetCbSize

func (si *SCROLLINFO) SetCbSize()

type SECURITY_ATTRIBUTES

type SECURITY_ATTRIBUTES struct {
	LpSecurityDescriptor uintptr // LPVOID
	// contains filtered or unexported fields
}

SECURITY_ATTRIBUTES struct.

⚠️ You must call SetNLength() to initialize the struct.

func (*SECURITY_ATTRIBUTES) BInheritHandle

func (sa *SECURITY_ATTRIBUTES) BInheritHandle() bool

func (*SECURITY_ATTRIBUTES) SetBInheritHandle

func (sa *SECURITY_ATTRIBUTES) SetBInheritHandle(val bool)

func (*SECURITY_ATTRIBUTES) SetNLength

func (sa *SECURITY_ATTRIBUTES) SetNLength()

type SECURITY_QUALITY_OF_SERVICE

type SECURITY_QUALITY_OF_SERVICE struct {
	ImpersonationLevel co.SECURITY_IMPERSONATION_LEVEL
	// contains filtered or unexported fields
}

SECURITY_QUALITY_OF_SERVICE struct.

⚠️ You must call SetLength() to initialize the struct.

func (*SECURITY_QUALITY_OF_SERVICE) ContextTrackingMode

func (qs *SECURITY_QUALITY_OF_SERVICE) ContextTrackingMode() bool

func (*SECURITY_QUALITY_OF_SERVICE) EffectiveOnly

func (qs *SECURITY_QUALITY_OF_SERVICE) EffectiveOnly() bool

func (*SECURITY_QUALITY_OF_SERVICE) SetContextTrackingMode

func (qs *SECURITY_QUALITY_OF_SERVICE) SetContextTrackingMode(val bool)

func (*SECURITY_QUALITY_OF_SERVICE) SetEffectiveOnly

func (qs *SECURITY_QUALITY_OF_SERVICE) SetEffectiveOnly(val bool)

func (*SECURITY_QUALITY_OF_SERVICE) SetLength

func (qs *SECURITY_QUALITY_OF_SERVICE) SetLength()

type SHFILEINFO

type SHFILEINFO struct {
	HIcon        HICON
	IIcon        int32
	DwAttributes co.SFGAO
	// contains filtered or unexported fields
}

SHFILEINFO struct.

func (*SHFILEINFO) SetSzDisplayName

func (shf *SHFILEINFO) SetSzDisplayName(val string)

func (*SHFILEINFO) SetSzTypeName

func (shf *SHFILEINFO) SetSzTypeName(val string)

func (*SHFILEINFO) SzDisplayName

func (shf *SHFILEINFO) SzDisplayName() string

func (*SHFILEINFO) SzTypeName

func (shf *SHFILEINFO) SzTypeName() string

type SIZE

type SIZE struct {
	Cx, Cy int32
}

SIZE struct.

Basic area size structure, with cx and cy values.

type STARTUPINFO

type STARTUPINFO struct {
	LpDesktop       *uint16
	LpTitle         *uint16
	DwX             uint32
	DwY             uint32
	DwXSize         uint32
	DwYSize         uint32
	DwXCountChars   uint32
	DwYCountChars   uint32
	DwFillAttribute uint32
	DwFlags         co.STARTF
	WShowWindow     uint16 // co.SW, should be uint16.

	HStdInput  uintptr
	HStdOutput uintptr
	HStdError  uintptr
	// contains filtered or unexported fields
}

STARTUPINFO struct.

⚠️ You must call SetCb() to initialize the struct.

func (*STARTUPINFO) SetCb

func (si *STARTUPINFO) SetCb()

type STYLESTRUCT_WS

type STYLESTRUCT_WS struct {
	StyleOld co.WS
	StyleNew co.WS
}

STYLESTRUCT for WS styles.

type STYLESTRUCT_WSEX

type STYLESTRUCT_WSEX struct {
	StyleOld co.WS_EX
	StyleNew co.WS_EX
}

STYLESTRUCT for WS_EX styles.

type SYSTEMTIME

type SYSTEMTIME struct {
	WYear         uint16
	WMonth        uint16
	WDayOfWeek    uint16
	WDay          uint16
	WHour         uint16
	WMinute       uint16
	WSecond       uint16
	WMilliseconds uint16
}

SYSTEMTIME struct.

Can be converted to FILETIME with SystemTimeToFileTime function.

func (*SYSTEMTIME) FromDuration

func (st *SYSTEMTIME) FromDuration(dur time.Duration)

Decomposes a time.Duration into this SYSTEMTIME fields.

func (*SYSTEMTIME) FromTime

func (st *SYSTEMTIME) FromTime(val time.Time)

Fills this SYSTEMTIME with the value of a time.Time.

func (*SYSTEMTIME) ToTime

func (st *SYSTEMTIME) ToTime() time.Time

Converts this SYSTEMTIME to time.Time.

type SYSTEM_INFO

type SYSTEM_INFO struct {
	WProcessorArchitecture co.PROCESSOR_ARCHITECTURE

	DwPageSize                  uint32
	LpMinimumApplicationAddress uintptr
	LpMaximumApplicationAddress uintptr
	DwActiveProcessorMask       uintptr
	DwNumberOfProcessors        uint32
	DwProcessorType             co.PROCESSOR
	DwAllocationGranularity     uint32
	WProcessorLevel             uint16
	WProcessorRevision          uint16
	// contains filtered or unexported fields
}

SYSTEM_INFO struct.

type StrOpt

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

Variant type for an optional string value.

Example:

realStr := win.StrOptSome("foo")

if s, ok := realStr.Str(); ok {
	println(s)
}

fakeStr := win.StrOptNone()

func StrOptNone

func StrOptNone() StrOpt

Creates a new StrOpt with an empty value.

func StrOptSome

func StrOptSome(str string) StrOpt

Creates a new StrOpt with a string value.

func (*StrOpt) IsNone

func (me *StrOpt) IsNone() bool

func (*StrOpt) IsSome

func (me *StrOpt) IsSome() bool

func (*StrOpt) Raw

func (me *StrOpt) Raw() unsafe.Pointer

Returns the *uint16 of the string converted to a native pointer, or nil.

func (*StrOpt) Str

func (me *StrOpt) Str() (string, bool)

type TASKDIALOGCONFIG

type TASKDIALOGCONFIG struct {
	HwndParent              HWND
	HInstance               HINSTANCE
	DwFlags                 co.TDF
	DwCommonButtons         co.TDCBF
	PszWindowTitle          string
	HMainIcon               TdcIcon // Union PCWSTR + HICON, but string resource won't be considered.
	PszMainInstruction      string
	PszContent              string
	PButtons                []TASKDIALOG_BUTTON
	NDefaultButton          int32
	PRadioButtons           []TASKDIALOG_BUTTON
	NDefaultRadioButton     int32
	PszVerificationText     string
	PszExpandedInformation  string
	PszExpandedControlText  string
	PszCollapsedControlText string
	HFooterIcon             TdcIcon // Union PCWSTR + HICON, but string resource won't be considered.
	PszFooter               string
	PfCallback              uintptr
	LpCallbackData          uintptr
	CxWidth                 uint32
}

TASKDIALOGCONFIG struct.

Note that this struct is originally packed, so we must serialized it before using it.

type TASKDIALOG_BUTTON

type TASKDIALOG_BUTTON struct {
	NButtonID     int32
	PszButtonText string
}

TASKDIALOG_BUTTON struct.

Note that this struct is originally packed, so we must serialized it before using it.

type TBBUTTON

type TBBUTTON struct {
	IdCommand int32
	FsState   co.TBSTATE
	FsStyle   co.BTNS

	DwData  uintptr
	IString *uint16 // can also be the index in the string list
	// contains filtered or unexported fields
}

TBBUTTON struct.

func (*TBBUTTON) IBitmap

func (tbb *TBBUTTON) IBitmap() (icon, imgList int)

func (*TBBUTTON) SetIBitmap

func (tbb *TBBUTTON) SetIBitmap(icon, imgList int)

type TBBUTTONINFO

type TBBUTTONINFO struct {
	DwMask    co.TBIF
	IdCommand int32
	IImage    int32
	FsState   co.TBSTATE
	FsStyle   co.BTNS
	Cx        uint16
	LParam    LPARAM // DWORD_PTR
	// contains filtered or unexported fields
}

TBBUTTONINFO struct.

⚠️ You must call SetCbSize() to initialize the struct.

Example:

tbbi := &TBBUTTONINFO{}
tbbi.SetCbSize()

func (*TBBUTTONINFO) PszText

func (tbi *TBBUTTONINFO) PszText() []uint16

func (*TBBUTTONINFO) SetCbSize

func (tbi *TBBUTTONINFO) SetCbSize()

func (*TBBUTTONINFO) SetPszText

func (tbi *TBBUTTONINFO) SetPszText(val []uint16)

type TEXTMETRIC

type TEXTMETRIC struct {
	TmHeight           uint32
	TmAscent           uint32
	TmDescent          uint32
	TmInternalLeading  uint32
	TmExternalLeading  uint32
	TmAveCharWidth     uint32
	TmMaxCharWidth     uint32
	TmWeight           uint32
	TmOverhang         uint32
	TmDigitizedAspectX uint32
	TmDigitizedAspectY uint32
	TmFirstChar        uint16
	TmLastChar         uint16
	TmDefaultChar      uint16
	TmBreakChar        uint16
	TmItalic           uint8
	TmUnderlined       uint8
	TmStruckOut        uint8
	TmPitchAndFamily   uint8
	TmCharSet          co.CHARSET
}

TEXTMETRIC struct.

type THREADENTRY32

type THREADENTRY32 struct {
	Th32ThreadID       uint32
	Th32OwnerProcessID uint32
	TpBasePri          int32
	// contains filtered or unexported fields
}

THREADENTRY32 struct.

⚠️ You must call SetDwSize() to initialize the struct.

func (*THREADENTRY32) SetDwSize

func (te *THREADENTRY32) SetDwSize()

type TIME_ZONE_INFORMATION

type TIME_ZONE_INFORMATION struct {
	Bias int32

	StandardDate SYSTEMTIME
	StandardBias int32

	DaylightDate SYSTEMTIME
	DaylightBias int32
	// contains filtered or unexported fields
}

TIME_ZONE_INFORMATION struct.

func (*TIME_ZONE_INFORMATION) DaylightName

func (tzi *TIME_ZONE_INFORMATION) DaylightName() string

func (*TIME_ZONE_INFORMATION) SetDaylightName

func (tzi *TIME_ZONE_INFORMATION) SetDaylightName(val string)

func (*TIME_ZONE_INFORMATION) SetStandardName

func (tzi *TIME_ZONE_INFORMATION) SetStandardName(val string)

func (*TIME_ZONE_INFORMATION) StandardName

func (tzi *TIME_ZONE_INFORMATION) StandardName() string

type TITLEBARINFOEX

type TITLEBARINFOEX struct {
	RcTitleBar RECT
	Rgstate    [_CCHILDREN_TITLEBAR + 1]uint32
	Rgrect     [_CCHILDREN_TITLEBAR + 1]RECT
	// contains filtered or unexported fields
}

TITLEBARINFOEX struct.

⚠️ You must call SetCbSize() to initialize the struct.

func (*TITLEBARINFOEX) SetCbSize

func (tix *TITLEBARINFOEX) SetCbSize()

type TOKEN_ELEVATION

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

TOKEN_ELEVATION struct.

func (*TOKEN_ELEVATION) TokenIsElevated

func (te *TOKEN_ELEVATION) TokenIsElevated() bool

type TOKEN_LINKED_TOKEN

type TOKEN_LINKED_TOKEN struct {
	LinkedToken HACCESSTOKEN
}

TOKEN_LINKED_TOKEN struct.

type TOKEN_MANDATORY_POLICY

type TOKEN_MANDATORY_POLICY struct {
	Policy co.TOKEN_POLICY
}

TOKEN_MANDATORY_POLICY struct.

type TVINSERTSTRUCT

type TVINSERTSTRUCT struct {
	HParent      HTREEITEM
	HInsertAfter HTREEITEM
	Itemex       TVITEMEX
}

TVINSERTSTRUCT struct.

type TVITEM

type TVITEM struct {
	Mask      co.TVIF
	HItem     HTREEITEM
	State     co.TVIS
	StateMask co.TVIS

	IImage         int32
	ISelectedImage int32
	CChildren      co.TVI_CHILDREN
	LParam         LPARAM
	// contains filtered or unexported fields
}

TVITEM struct.

func (*TVITEM) PszText

func (tvi *TVITEM) PszText() []uint16

func (*TVITEM) SetPszText

func (tvi *TVITEM) SetPszText(val []uint16)

type TVITEMEX

type TVITEMEX struct {
	Mask      co.TVIF
	HItem     HTREEITEM
	State     co.TVIS
	StateMask co.TVIS

	IImage         int32
	ISelectedImage int32
	CChildren      co.TVI_CHILDREN
	LParam         LPARAM
	IIntegral      int32
	UStateEx       co.TVIS_EX
	Hwnd           HWND
	IExpandedImage int32
	// contains filtered or unexported fields
}

TVITEMEX struct.

func (*TVITEMEX) PszText

func (tvx *TVITEMEX) PszText() []uint16

func (*TVITEMEX) SetPszText

func (tvx *TVITEMEX) SetPszText(val []uint16)

type TdcIcon

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

Variant type for an icon identifier for TASKDIALOGCONFIG.

Example

ico := TdcIconTdi(co.TD_ICON_ERROR)

if tdi, ok := ico.Tdi(); ok {
	println(tdi)
}

func TdcIconHicon

func TdcIconHicon(hIcon HICON) TdcIcon

Creates a new TdcIcon variant with an HICON value.

func TdcIconInt

func TdcIconInt(id int) TdcIcon

Creates a new TdcIcon variant with an int value.

func TdcIconNone

func TdcIconNone() TdcIcon

Creates a new TdcIcon variant with an empty value.

func TdcIconTdi

func TdcIconTdi(tdIcon co.TD_ICON) TdcIcon

Creates a new TdcIcon variant with a co.TD_ICON value.

func (*TdcIcon) HIcon

func (me *TdcIcon) HIcon() (HICON, bool)

func (*TdcIcon) Id

func (me *TdcIcon) Id() (int, bool)

func (*TdcIcon) IsNone

func (me *TdcIcon) IsNone() bool

func (*TdcIcon) Tdi

func (me *TdcIcon) Tdi() (co.TD_ICON, bool)

type VS_FIXEDFILEINFO

type VS_FIXEDFILEINFO struct {
	DwSignature    uint32
	DwStrucVersion uint32

	DwFileFlagsMask co.VS_FF
	DwFileFlags     co.VS_FF
	DwFileOS        co.VOS
	DwFileType      co.VFT
	DwFileSubtype   co.VFT2
	// contains filtered or unexported fields
}

VS_FIXEDFILEINFO struct.

func (*VS_FIXEDFILEINFO) FileDate

func (ffi *VS_FIXEDFILEINFO) FileDate() uint64

func (*VS_FIXEDFILEINFO) FileVersion

func (ffi *VS_FIXEDFILEINFO) FileVersion() (major, minor, patch, build uint16)

func (*VS_FIXEDFILEINFO) ProductVersion

func (ffi *VS_FIXEDFILEINFO) ProductVersion() (major, minor, patch, build uint16)

func (*VS_FIXEDFILEINFO) SetFileDate

func (ffi *VS_FIXEDFILEINFO) SetFileDate(val uint64)

func (*VS_FIXEDFILEINFO) SetFileVersion

func (ffi *VS_FIXEDFILEINFO) SetFileVersion(major, minor, patch, build uint16)

func (*VS_FIXEDFILEINFO) SetProductVersion

func (ffi *VS_FIXEDFILEINFO) SetProductVersion(major, minor, patch, build uint16)

type WIN32_FIND_DATA

type WIN32_FIND_DATA struct {
	DwFileAttributes co.FILE_ATTRIBUTE
	FtCreationTime   FILETIME
	FtLastAccessTime FILETIME
	FtLastWriteTime  FILETIME
	NFileSizeHigh    uint32
	NFileSizeLow     uint32

	DwFileType    uint32
	DwCreatorType uint32
	WFinderFlags  uint16
	// contains filtered or unexported fields
}

WIN32_FIND_DATA struct.

func (*WIN32_FIND_DATA) CAlternateFileName

func (wfd *WIN32_FIND_DATA) CAlternateFileName() string

func (*WIN32_FIND_DATA) CFileName

func (wfd *WIN32_FIND_DATA) CFileName() string

func (*WIN32_FIND_DATA) SetCAlternateFileName

func (wfd *WIN32_FIND_DATA) SetCAlternateFileName(val string)

func (*WIN32_FIND_DATA) SetCFileName

func (wfd *WIN32_FIND_DATA) SetCFileName(val string)

type WINDOWPOS

type WINDOWPOS struct {
	HwndInsertAfter HWND
	Hwnd            HWND
	X, Y, Cx, Cy    int32
	Flags           co.SWP
}

WINDOWPOS struct.

type WNDCLASSEX

type WNDCLASSEX struct {
	Style         co.CS
	LpfnWndProc   uintptr // WNDPROC
	CbClsExtra    int32
	CbWndExtra    int32
	HInstance     HINSTANCE
	HIcon         HICON
	HCursor       HCURSOR
	HbrBackground HBRUSH
	LpszMenuName  uintptr
	LpszClassName *uint16
	HIconSm       HICON
	// contains filtered or unexported fields
}

WNDCLASSEX struct.

⚠️ You must call SetCbSize() to initialize the struct.

func (*WNDCLASSEX) SetCbSize

func (wcx *WNDCLASSEX) SetCbSize()

type WPARAM

type WPARAM uintptr

First message parameter.

func MAKEWPARAM

func MAKEWPARAM(lo, hi uint16) WPARAM

MAKEWPARAM macro.

func (WPARAM) HiWord

func (wp WPARAM) HiWord() uint16

func (WPARAM) LoWord

func (wp WPARAM) LoWord() uint16

Jump to

Keyboard shortcuts

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