新增: 相册展示模块(左侧幻灯片+进度条+目录选择)
- 左侧固定卡片展示照片幻灯片,淡入淡出切换 - 进度条动画显示当前照片剩余时间 - 设置窗口支持选择图片目录和切换间隔(5/10/15/20/30/60秒) - Win32 SHBrowseForFolderW 目录选择对话框 - Go 端管理幻灯片状态,按间隔推送照片 data URI
This commit is contained in:
38
dialog.go
38
dialog.go
@@ -12,6 +12,13 @@ var (
|
||||
comdlg32 = windows.NewLazySystemDLL("comdlg32.dll")
|
||||
procGetOpenFileNameW = comdlg32.NewProc("GetOpenFileNameW")
|
||||
procChooseColorW = comdlg32.NewProc("ChooseColorW")
|
||||
|
||||
shell32 = windows.NewLazySystemDLL("shell32.dll")
|
||||
procSHBrowseForFolderW = shell32.NewProc("SHBrowseForFolderW")
|
||||
procSHGetPathFromIDListW = shell32.NewProc("SHGetPathFromIDListW")
|
||||
|
||||
ole32dll = windows.NewLazySystemDLL("ole32.dll")
|
||||
procCoTaskMemFree = ole32dll.NewProc("CoTaskMemFree")
|
||||
)
|
||||
|
||||
func slicePtr(s interface{}) uintptr {
|
||||
@@ -117,3 +124,34 @@ func colorPickerDialog(owner uintptr, initialColor string) string {
|
||||
b := (cc.rgbResult >> 16) & 0xFF
|
||||
return fmt.Sprintf("#%02x%02x%02x", r, g, b)
|
||||
}
|
||||
|
||||
func browseForFolderDialog(owner uintptr) string {
|
||||
title, _ := windows.UTF16PtrFromString("选择图片目录")
|
||||
var displayName [260]uint16
|
||||
|
||||
bi := struct {
|
||||
HwndOwner uintptr
|
||||
PidlRoot uintptr
|
||||
PszDisplayName uintptr
|
||||
LpszTitle uintptr
|
||||
UlFlags uint32
|
||||
LpFn uintptr
|
||||
LParam uintptr
|
||||
IImage int32
|
||||
}{
|
||||
HwndOwner: owner,
|
||||
PszDisplayName: uintptr(unsafe.Pointer(&displayName[0])),
|
||||
LpszTitle: uintptr(unsafe.Pointer(title)),
|
||||
UlFlags: 0x00000001 | 0x00000040,
|
||||
}
|
||||
|
||||
pidl, _, _ := procSHBrowseForFolderW.Call(uintptr(unsafe.Pointer(&bi)))
|
||||
if pidl == 0 {
|
||||
return ""
|
||||
}
|
||||
defer procCoTaskMemFree.Call(pidl)
|
||||
|
||||
var path [260]uint16
|
||||
procSHGetPathFromIDListW.Call(pidl, uintptr(unsafe.Pointer(&path[0])))
|
||||
return windows.UTF16ToString(path[:])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user