mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 00:13:46 +01:00
* Rename manager.instance to Manager * Show dialog message on fatal error on Windows * Hide console windows explicitly on icon launch Gets rid of the windowsgui flag, which causes all sorts of issues. Instead, checks if stash was launched from the icon, and if so hides the console. * Remove fixconsole * Add changelog entries
33 lines
680 B
Go
33 lines
680 B
Go
//go:build windows
|
|
// +build windows
|
|
|
|
package desktop
|
|
|
|
import (
|
|
"fmt"
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
func FatalError(err error) int {
|
|
const (
|
|
NULL = 0
|
|
MB_OK = 0
|
|
MB_ICONERROR = 0x10
|
|
)
|
|
|
|
return messageBox(NULL, fmt.Sprintf("Error: %v", err), "Stash - Fatal Error", MB_OK|MB_ICONERROR)
|
|
}
|
|
|
|
func messageBox(hwnd uintptr, caption, title string, flags uint) int {
|
|
lpText, _ := syscall.UTF16PtrFromString(caption)
|
|
lpCaption, _ := syscall.UTF16PtrFromString(title)
|
|
|
|
ret, _, _ := syscall.NewLazyDLL("user32.dll").NewProc("MessageBoxW").Call(
|
|
uintptr(hwnd),
|
|
uintptr(unsafe.Pointer(lpText)),
|
|
uintptr(unsafe.Pointer(lpCaption)),
|
|
uintptr(flags))
|
|
|
|
return int(ret)
|
|
}
|