Sciter开发记录
2024-07-02 00:01:28
//首先现在官方的DLL文件 我这里用最新版的 5.0.3.13
https://gitlab.com/sciter-engine/sciter-js-sdk/-/archive/main/sciter-js-sdk-main.zip
参考文章:https://blog.csdn.net/xiaochuanxuzhou/article/details/136046855
优秀的中文学习资料: https://blog.csdn.net/xiaochuanxuzhou/article/details/136046855
//首先安装库:
go get github.com/sciter-sdk/go-sciter@master
然后,初始化代码:
package main import ( "fmt" "github.com/sciter-sdk/go-sciter" "github.com/sciter-sdk/go-sciter/window" "syscall" ) // SetProcessDPIAware 启用高dpi,如果用户不是admin,可能会报错。 // 为了应对win10这种屏幕自动调整分辨率和缩放比例造成的字体模糊。 func SetProcessDPIAware() error { moduser32 := syscall.NewLazyDLL("user32.dll") setProcessDPIAware := moduser32.NewProc("SetProcessDPIAware") _, _, err := setProcessDPIAware.Call() if err != nil { return err } return nil } func main() { err := SetProcessDPIAware() if err != nil { fmt.Println("Failed to set DPI awareness:", err) } else { fmt.Println("DPI awareness set successfully.") } w, _ := window.New( sciter.SW_MAIN|sciter.SW_CONTROLS|sciter.SW_RESIZEABLE|sciter.SW_ENABLE_DEBUG, &sciter.Rect{0, 0, 500, 500}) w.LoadFile("main.html") w.Show() w.Run() }