winapi

package
v0.0.0-...-bd774c8 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SRCCOPY        = 0x00CC0020
	SRCPAINT       = 0x00EE0086
	SRCAND         = 0x008800C6
	SRCINVERT      = 0x00660046
	SRCERASE       = 0x00440328
	NOTSRCCOPY     = 0x00330008
	NOTSRCERASE    = 0x001100A6
	MERGECOPY      = 0x00C000CA
	MERGEPAINT     = 0x00BB0226
	PATCOPY        = 0x00F00021
	PATPAINT       = 0x00FB0A09
	PATINVERT      = 0x005A0049
	DSTINVERT      = 0x00550009
	BLACKNESS      = 0x00000042
	WHITENESS      = 0x00FF0062
	NOMIRRORBITMAP = 0x80000000
	CAPTUREBLT     = 0x40000000
)

Ternary raster operations

View Source
const (
	DIB_RGB_COLORS = 0
	DIB_PAL_COLORS = 1
)

Bitmap color table usage

View Source
const (
	BI_RGB       = 0
	BI_RLE8      = 1
	BI_RLE4      = 2
	BI_BITFIELDS = 3
	BI_JPEG      = 4
	BI_PNG       = 5
)

Bitmap compression constants

View Source
const (
	GHND          = 0x0042
	GMEM_FIXED    = 0x0000
	GMEM_MOVEABLE = 0x0002
	GMEM_ZEROINIT = 0x0040
	GPTR          = GMEM_FIXED | GMEM_ZEROINIT
)

GlobalAlloc flags

View Source
const (
	LHND          = 0x0042
	LMEM_FIXED    = 0x0000
	LMEM_MOVEABLE = 0x0002
	LMEM_ZEROINIT = 0x0040
	LPTR          = LMEM_FIXED | LMEM_ZEROINIT
)

LocalAlloc flags

Variables

This section is empty.

Functions

func BitBlt

func BitBlt(
	destinationHandleDeviceContext HDC,
	destinationX, destinationY int32,
	width, height int32,
	sourceHandleDeviceContext HDC,
	sourceX, sourceY int32,
	rasterOperationCode uint,
) error

The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.

func DeleteDC

func DeleteDC(handleDeviceContext HDC) error

The DeleteDC function deletes the specified device context (DC).

func DeleteObject

func DeleteObject(handleObject HGDIOBJ) error

The DeleteObject function deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid.

func GetClientRect

func GetClientRect(handleWindow windows.HWND) (windows.Rect, error)

Retrieves the coordinates of a window's client area. The client coordinates specify the upper-left and lower-right corners of the client area. Because client coordinates are relative to the upper-left corner of a window's client area, the coordinates of the upper-left corner are (0,0).

func GetDIBits

func GetDIBits(handleDeviceContext HDC, handleBitmap HBITMAP, firstScanLine uint32, scanLinesCount uint32, receiveBuffer *byte, bitmapInfo *BITMAPINFO, colorsFormat uint32) error

The GetDIBits function retrieves the bits of the specified compatible bitmap and copies them into a buffer as a DIB using the specified format.

func GetDesktopWindow

func GetDesktopWindow() windows.HWND

Retrieves a handle to the desktop window. The desktop window covers the entire screen. The desktop window is the area on top of which other windows are painted.

func GetWindowRect

func GetWindowRect(handleWindow windows.HWND) (windows.Rect, error)

Retrieves the dimensions of the bounding rectangle of the specified window. The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen.

func GlobalLock

func GlobalLock(handleMemory HGLOBAL) (unsafe.Pointer, error)

Locks a global memory object and returns a pointer to the first byte of the object's memory block.

func GlobalUnlock

func GlobalUnlock(handleMemory HGLOBAL) bool

Decrements the lock count associated with a memory object that was allocated with GMEM_MOVEABLE. This function has no effect on memory objects allocated with GMEM_FIXED.

func ReleaseDC

func ReleaseDC(handleWindow windows.HWND, handleDeviceContext HDC) error

The ReleaseDC function releases a device context (DC), freeing it for use by other applications. The effect of the ReleaseDC function depends on the type of DC. It frees only common and window DCs. It has no effect on class or private DCs.

Types

type BITMAPINFO

type BITMAPINFO struct {
	BmiHeader BITMAPINFOHEADER
	BmiColors *RGBQUAD
}

type BITMAPINFOHEADER

type BITMAPINFOHEADER struct {
	BiSize          uint32
	BiWidth         int32
	BiHeight        int32
	BiPlanes        uint16
	BiBitCount      uint16
	BiCompression   uint32
	BiSizeImage     uint32
	BiXPelsPerMeter int32
	BiYPelsPerMeter int32
	BiClrUsed       uint32
	BiClrImportant  uint32
}

type HANDLE

type HANDLE windows.Handle

type HBITMAP

type HBITMAP HANDLE

func CreateCompatibleBitmap

func CreateCompatibleBitmap(handleDeviceContext HDC, bitmapWidth int32, bitmapHeight int32) (HBITMAP, error)

The CreateCompatibleBitmap function creates a bitmap compatible with the device that is associated with the specified device context.

type HDC

type HDC HANDLE

func CreateCompatibleDC

func CreateCompatibleDC(handleDeviceContext HDC) (HDC, error)

The CreateCompatibleDC function creates a memory device context (DC) compatible with the specified device.

func GetWindowDC

func GetWindowDC(handleWindow windows.HWND) (HDC, error)

The GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. A window device context permits painting anywhere in a window, because the origin of the device context is the upper-left corner of the window instead of the client area. GetWindowDC assigns default attributes to the window device context each time it retrieves the device context. Previous attributes are lost.

type HGDIOBJ

type HGDIOBJ HANDLE

func SelectObject

func SelectObject(handleDeviceContext HDC, handleObject HGDIOBJ) (HGDIOBJ, error)

The SelectObject function selects an object into the specified device context (DC). The new object replaces the previous object of the same type.

type HGLOBAL

type HGLOBAL HANDLE

func GlobalAlloc

func GlobalAlloc(flags uint32, bytes uintptr) (HGLOBAL, error)

Allocates the specified number of bytes from the heap.

func GlobalFree

func GlobalFree(handleMemory HGLOBAL) (HGLOBAL, error)

Frees the specified global memory object and invalidates its handle.

type HRESULT

type HRESULT HANDLE

type LPVOID

type LPVOID unsafe.Pointer

type POINT

type POINT struct {
	X int32
	Y int32
}

func PhysicalToLogicalPointForPerMonitorDPI

func PhysicalToLogicalPointForPerMonitorDPI(handleWindow windows.HWND, point POINT) (POINT, error)

func ScreenToClient

func ScreenToClient(handleWindow windows.HWND, point POINT) (POINT, error)

The ScreenToClient function converts the screen coordinates of a specified point on the screen to client-area coordinates.

type ProcessId

type ProcessId uint32

type RGBQUAD

type RGBQUAD struct {
	RgbBlue     byte
	RgbGreen    byte
	RgbRed      byte
	RgbReserved byte
}

Jump to

Keyboard shortcuts

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