go-toast

Send toast notifications in Windows
Log | Files | Refs | README | LICENSE

toastnotificationmanagerforuser.go (1901B)


      1 // Code generated by winrt-go-gen. DO NOT EDIT.
      2 
      3 //go:build windows
      4 
      5 //nolint:all
      6 package notifications
      7 
      8 import (
      9 	"syscall"
     10 	"unsafe"
     11 
     12 	"github.com/go-ole/go-ole"
     13 )
     14 
     15 const SignatureToastNotificationManagerForUser string = "rc(Windows.UI.Notifications.ToastNotificationManagerForUser;{79ab57f6-43fe-487b-8a7f-99567200ae94})"
     16 
     17 type ToastNotificationManagerForUser struct {
     18 	ole.IUnknown
     19 }
     20 
     21 func (impl *ToastNotificationManagerForUser) CreateToastNotifierWithId(applicationId string) (*ToastNotifier, error) {
     22 	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiToastNotificationManagerForUser))
     23 	defer itf.Release()
     24 	v := (*iToastNotificationManagerForUser)(unsafe.Pointer(itf))
     25 	return v.CreateToastNotifierWithId(applicationId)
     26 }
     27 
     28 const (
     29 	GUIDiToastNotificationManagerForUser      string = "79ab57f6-43fe-487b-8a7f-99567200ae94"
     30 	SignatureiToastNotificationManagerForUser string = "{79ab57f6-43fe-487b-8a7f-99567200ae94}"
     31 )
     32 
     33 type iToastNotificationManagerForUser struct {
     34 	ole.IInspectable
     35 }
     36 
     37 type iToastNotificationManagerForUserVtbl struct {
     38 	ole.IInspectableVtbl
     39 
     40 	CreateToastNotifier       uintptr
     41 	CreateToastNotifierWithId uintptr
     42 	GetHistory                uintptr
     43 	GetUser                   uintptr
     44 }
     45 
     46 func (v *iToastNotificationManagerForUser) VTable() *iToastNotificationManagerForUserVtbl {
     47 	return (*iToastNotificationManagerForUserVtbl)(unsafe.Pointer(v.RawVTable))
     48 }
     49 
     50 func (v *iToastNotificationManagerForUser) CreateToastNotifierWithId(applicationId string) (*ToastNotifier, error) {
     51 	var out *ToastNotifier
     52 	applicationIdHStr, err := ole.NewHString(applicationId)
     53 	if err != nil {
     54 		return nil, err
     55 	}
     56 	hr, _, _ := syscall.SyscallN(
     57 		v.VTable().CreateToastNotifierWithId,
     58 		uintptr(unsafe.Pointer(v)),    // this
     59 		uintptr(applicationIdHStr),    // in string
     60 		uintptr(unsafe.Pointer(&out)), // out ToastNotifier
     61 	)
     62 
     63 	if hr != 0 {
     64 		return nil, ole.NewError(hr)
     65 	}
     66 
     67 	return out, nil
     68 }