go-toast

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

commit adcdbf00e925bbf613aee84cb94d28f7b2ec5228
parent e76d509b45be5b6ccbac91f4a63b8f6751e9b0d6
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date:   Wed, 15 Mar 2023 14:14:06 +0800

internal/bind: lazy load DLL

This will let us test for the DLL without panicking,
allows implementing the powershell fallback.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>

Diffstat:
Minternal/bind/bind.go | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/internal/bind/bind.go b/internal/bind/bind.go @@ -23,9 +23,9 @@ import ( const iNotificationActivationCallbackGUID = "{0F82E845-CB89-4039-BDBF-67CA33254C76}" var ( - toast = windows.MustLoadDLL("toast.dll") - procGenerateToast = toast.MustFindProc("GenerateToast") - procSetActivationCallback = toast.MustFindProc("SetActivationCallback") + toast = windows.NewLazyDLL("toast.dll") + procGenerateToast = toast.NewProc("GenerateToast") + procSetActivationCallback = toast.NewProc("SetActivationCallback") ) // ConfigureRegistry installs various keys that tell the Windows Runtime details about our