screen

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 窗口样式
	WS_POPUP         = 0x80000000 // 弹出式窗口(无标题栏、无边框)
	WS_VISIBLE       = 0x10000000 // 创建时即可见
	WS_EX_TOPMOST    = 0x00000008 // 扩展样式:总在最前
	WS_EX_TOOLWINDOW = 0x00000080 // 扩展样式:工具窗口(不在任务栏显示,Alt+Tab中不可见)
	WS_EX_LAYERED    = 0x00080000 // 扩展样式:分层窗口(用于实现透明效果)
	LWA_COLORKEY     = 0x00000001 // 分层属性:使用颜色键抠图(指定颜色变透明)

	// 窗口消息
	WM_PAINT   = 0x000F // 绘图消息
	WM_DESTROY = 0x0002 // 销毁消息

	// 类样式
	CS_HREDRAW = 0x0002 // 水平尺寸变化时重绘
	CS_VREDRAW = 0x0001 // 垂直尺寸变化时重绘

	// 文本绘制格式
	DT_CENTER     = 0x00000001 // 水平居中
	DT_VCENTER    = 0x00000004 // 垂直居中
	DT_SINGLELINE = 0x00000020 // 单行显示

	// 背景模式
	TRANSPARENT = 1 // 文本背景透明(即文字后面不画矩形底色)

	// 系统度量常量 (GetSystemMetrics)
	SM_CXSCREEN = 0 // 屏幕宽度
	SM_CYSCREEN = 1 // 屏幕高度
)

--- Windows API 常量定义 --- 这些常量对应 Windows 头文件中的定义,用于控制窗口样式、消息类型和绘图选项

Variables

This section is empty.

Functions

func ScreenGetText

func ScreenGetText() string

func ScreenInit

func ScreenInit()

Screen 初始化并运行状态窗口 注意:该函数包含死循环(消息循环),应在单独的 Goroutine 或主线程末尾运行

func ScreenUpdateText

func ScreenUpdateText(text string)

Update 更新显示的文本并触发窗口重绘 该函数是线程安全的,可以在其他 Goroutine 中调用

Types

type MSG

type MSG struct {
	Hwnd    syscall.Handle
	Message uint32
	WParam  uintptr
	LParam  uintptr
	Time    uint32
	Pt      struct{ X, Y int32 }
}

MSG: 消息结构体

type PAINTSTRUCT

type PAINTSTRUCT struct {
	Hdc         syscall.Handle // 设备上下文句柄
	Erase       int32
	RcPaint     RECT // 需要重绘的矩形区域
	Restore     int32
	IncUpdate   int32
	RgbReserved [32]byte
}

PAINTSTRUCT: 绘图信息结构体,用于 BeginPaint/EndPaint

type RECT

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

RECT: 矩形坐标

type WNDCLASSEX

type WNDCLASSEX struct {
	Size       uint32
	Style      uint32
	WndProc    uintptr // 窗口过程回调函数指针
	ClsExtra   int32
	WndExtra   int32
	Instance   syscall.Handle // 应用程序实例句柄
	Icon       syscall.Handle
	Cursor     syscall.Handle
	Background syscall.Handle // 背景画刷
	MenuName   *uint16
	ClassName  *uint16 // 窗口类名
	IconSm     syscall.Handle
}

--- Windows API 结构体映射 --- WNDCLASSEX: 窗口类结构体,定义窗口的基本属性

Jump to

Keyboard shortcuts

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