diff options
| author | Kurenai <[email protected]> | 2021-10-17 00:02:28 +0800 |
|---|---|---|
| committer | Kurenai <[email protected]> | 2021-10-17 00:24:41 +0800 |
| commit | 70a7c4edba281122c05ef46e9efffe5309ef8448 (patch) | |
| tree | 9e22aa0754ec0bea7f040874dfe3d626a4549503 /cmd/title_windows.go | |
| parent | 41568b669ab6bf44e01c7b95584a03a9ce7de8eb (diff) | |
Bump to 3.1.1
Diffstat (limited to 'cmd/title_windows.go')
| -rw-r--r-- | cmd/title_windows.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cmd/title_windows.go b/cmd/title_windows.go new file mode 100644 index 0000000..fc40785 --- /dev/null +++ b/cmd/title_windows.go @@ -0,0 +1,21 @@ +//go:build windows +package main + +import ( + "syscall" + "unsafe" +) + +func setWindowTitle(title string) { + kernel32, err := syscall.LoadLibrary("kernel32.dll") + if err == nil { + defer syscall.FreeLibrary(kernel32) + setConsoleTitle, err := syscall.GetProcAddress(kernel32, "SetConsoleTitleW") + if err == nil { + ptr, err := syscall.UTF16PtrFromString(title) + if err == nil { + syscall.Syscall(setConsoleTitle, 1, uintptr(unsafe.Pointer(ptr)), 0, 0) + } + } + } +} |
