123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- //go:build windows
- package wintray
- import (
- "unsafe"
- "golang.org/x/sys/windows"
- )
- // Contains window class information.
- // It is used with the RegisterClassEx and GetClassInfoEx functions.
- // https://msdn.microsoft.com/en-us/library/ms633577.aspx
- type wndClassEx struct {
- Size, Style uint32
- WndProc uintptr
- ClsExtra, WndExtra int32
- Instance, Icon, Cursor, Background windows.Handle
- MenuName, ClassName *uint16
- IconSm windows.Handle
- }
- // Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.
- // https://msdn.microsoft.com/en-us/library/ms633587.aspx
- func (w *wndClassEx) register() error {
- w.Size = uint32(unsafe.Sizeof(*w))
- res, _, err := pRegisterClass.Call(uintptr(unsafe.Pointer(w)))
- if res == 0 {
- return err
- }
- return nil
- }
- // Unregisters a window class, freeing the memory required for the class.
- // https://msdn.microsoft.com/en-us/library/ms644899.aspx
- func (w *wndClassEx) unregister() error {
- res, _, err := pUnregisterClass.Call(
- uintptr(unsafe.Pointer(w.ClassName)),
- uintptr(w.Instance),
- )
- if res == 0 {
- return err
- }
- return nil
- }
|