signal

package module
v0.0.0-...-053fc54 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CtrlCEvent        = CtrlEvent(0)
	CtrlBreakEvent    = CtrlEvent(1)
	CtrlCloseEvent    = CtrlEvent(2)
	CtrlLogoffEvent   = CtrlEvent(5)
	CtrlShutdownEvent = CtrlEvent(6)
)

Defines the different control events.

Variables

View Source
var (
	// ErrNoWndHandle return if no valid window handle found.
	ErrNoWndHandle = errors.New("no window handle found for the given process id")
)

Functions

func SendCtrlEvent

func SendCtrlEvent(pid uint32, ctrlEvent CtrlEvent) error

SendCtrlEvent sends a windows control event. Caveat: If the the process that calls this functions has already a console attached, this call will fail. This call will also call SetConsoleCtrlHandler(0, true) to prevent ourself from receiving the event.

func SendSignal

func SendSignal(pid uint32, msg WindowsMessage) error

SendSignal sends a Windows message to all windows handles that belongs to a given process.

Types

type CtrlEvent

type CtrlEvent uint32

CtrlEvent is a Window control event.

type DWORD

type DWORD uint32

DWORD is a 32-bit unsigend int.

type HWND

type HWND windows.Handle

HWND is a windows handle.

type LPDWORD

type LPDWORD unsafe.Pointer

LPDWORD is a pointer to a uint32.

type UINT

type UINT uint32

UINT is a 32-bit unsigned int.

type WindowsMessage

type WindowsMessage uint64

WindowsMessage defines Windows system messages. See for example https://docs.microsoft.com/en-us/windows/win32/winmsg/wm-close

const (
	// WmClose sent as a signal that a window or an application should terminate.
	WmClose WindowsMessage = 0x0010
	// WmQuit indicates a request to terminate an application, and is generated when the application calls the PostQuitMessage function.
	WmQuit WindowsMessage = 0x0012
)

func (WindowsMessage) String

func (w WindowsMessage) String() string

Jump to

Keyboard shortcuts

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