systray

package module
v0.0.0-...-90cb07e Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 5 Imported by: 0

README

go-windows-systray

Go system tray icon library for windows.

Almost entirely copied from https://github.com/hallazzang/go-tray-icons-tutorial

Documentation

Index

Constants

View Source
const (
	IMAGE_ICON = 1

	LR_DEFAULTSIZE  = 0x00000040
	LR_LOADFROMFILE = 0x00000010

	SW_SHOW = 5

	CW_USEDEFAULT = ^0x7fffffff

	WS_CAPTION          = 0x00c00000
	WS_MAXIMIZEBOX      = 0x00010000
	WS_MINIMIZEBOX      = 0x00020000
	WS_OVERLAPPED       = 0x00000000
	WS_SYSMENU          = 0x00080000
	WS_THICKFRAME       = 0x00040000
	WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX

	WM_DESTROY       = 0x0002
	WM_SETICON       = 0x0080
	WM_MOUSEMOVE     = 0x0200
	WM_LBUTTONDOWN   = 0x0201
	WM_LBUTTONUP     = 0x0202
	WM_LBUTTONDBLCLK = 0x0203
	WM_RBUTTONDOWN   = 0x0204
	WM_RBUTTONUP     = 0x0205
	WM_RBUTTONDBLCLK = 0x0206
	WM_APP           = 0x8000
)

Created by https://github.com/hallazzang/

View Source
const (
	NIM_ADD        = 0x00000000
	NIM_MODIFY     = 0x00000001
	NIM_DELETE     = 0x00000002
	NIM_SETFOCUS   = 0x00000003
	NIM_SETVERSION = 0x00000004

	NIF_MESSAGE  = 0x00000001
	NIF_ICON     = 0x00000002
	NIF_TIP      = 0x00000004
	NIF_STATE    = 0x00000008
	NIF_INFO     = 0x00000010
	NIF_GUID     = 0x00000020
	NIF_REALTIME = 0x00000040
	NIF_SHOWTIP  = 0x00000080

	NIS_HIDDEN     = 0x00000001
	NIS_SHAREDICON = 0x00000002
)
View Source
const TrayIconMsg = WM_APP + 1

Variables

This section is empty.

Functions

func CreateWindowEx

func CreateWindowEx(
	dwExStyle uint32,
	lpClassName, lpWindowName *uint16,
	dwStyle uint32,
	X, Y, nWidth, nHeight int32,
	hWndParent, hMenu, hInstance uintptr,
	lpParam unsafe.Pointer) (uintptr, error)

func DefWindowProc

func DefWindowProc(
	hWnd uintptr,
	Msg uint32,
	wParam, lParam uintptr) (uintptr, error)

func GetModuleHandle

func GetModuleHandle(lpModuleName *uint16) (uintptr, error)

func LOWORD

func LOWORD(dwValue uint32) uint16

func LoadImage

func LoadImage(
	hInst uintptr,
	name *uint16,
	type_ uint32,
	cx, cy int32,
	fuLoad uint32) (uintptr, error)

func PostQuitMessage

func PostQuitMessage(nExitCode int32)

func RegisterClassEx

func RegisterClassEx(Arg1 *WNDCLASSEX) (uint16, error)

func Shell_NotifyIcon

func Shell_NotifyIcon(
	dwMessage uint32,
	lpData *NOTIFYICONDATA) (int32, error)

Types

type GUID

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

type MSG

type MSG struct {
	Hwnd     uintptr
	Message  uint32
	WParam   uintptr
	LParam   uintptr
	Time     uint32
	Pt       POINT
	LPrivate uint32
}

type NOTIFYICONDATA

type NOTIFYICONDATA struct {
	CbSize           uint32
	HWnd             uintptr
	UID              uint32
	UFlags           uint32
	UCallbackMessage uint32
	HIcon            uintptr
	SzTip            [128]uint16
	DwState          uint32
	DwStateMask      uint32
	SzInfo           [256]uint16
	UVersion         uint32
	SzInfoTitle      [64]uint16
	DwInfoFlags      uint32
	GUIDItem         GUID
	HBalloonIcon     uintptr
}

type POINT

type POINT struct {
	X int32
	Y int32
}

type TrayIcon

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

func NewTrayIcon

func NewTrayIcon() (*TrayIcon, error)

func (*TrayIcon) Dispose

func (ti *TrayIcon) Dispose() error

func (*TrayIcon) SetIcon

func (ti *TrayIcon) SetIcon(iconFileName string) error

func (*TrayIcon) SetTooltip

func (ti *TrayIcon) SetTooltip(tooltip string) error

type WNDCLASSEX

type WNDCLASSEX struct {
	CbSize        uint32
	Style         uint32
	LpfnWndProc   uintptr
	CbClsExtra    int32
	CbWndExtra    int32
	HInstance     uintptr
	HIcon         uintptr
	HCursor       uintptr
	HbrBackground uintptr
	LpszMenuName  *uint16
	LpszClassName *uint16
	HIconSm       uintptr
}

Jump to

Keyboard shortcuts

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