sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.57k stars 268 forks source link

Report an error when running the first demo? #261

Closed cnchef closed 3 years ago

cnchef commented 3 years ago

Windows 10 go version go1.14.2 windows/amd64 gcc version 10.2.0 (Rev5, Built by MSYS2 project)

sciter_test1.go

package main

import (
    "github.com/sciter-sdk/go-sciter"
    "github.com/sciter-sdk/go-sciter/window"
    "log"
)

func main() {
    //创建window窗口
    //参数一表示创建窗口的样式
    //SW_TITLEBAR 顶层窗口,有标题栏
    //SW_RESIZEABLE 可调整大小
    //SW_CONTROLS 有最小/最大按钮
    //SW_MAIN 应用程序主窗口,关闭后其他所有窗口也会关闭
    //SW_ENABLE_DEBUG 可以调试
    //参数二表示创建窗口的矩形
    //w, err := window.New(sciter.SW_TITLEBAR|
    //  sciter.SW_RESIZEABLE|
    //  sciter.SW_CONTROLS|
    //  sciter.SW_MAIN|
    //  sciter.SW_ENABLE_DEBUG,
    //  nil);
    w, err := window.New(sciter.SW_MAIN,nil)
    if err != nil {
        log.Fatal(err);
    }
    //加载文件
    w.LoadFile("demo1.html");
    //设置标题
    w.SetTitle("你好,世界");
    //显示窗口
    w.Show();
    //运行窗口,进入消息循环
    w.Run();
}

demo1.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    你好,世界
</body>
</html>

go run sciter_test1.go

golang.org/x/sys/windows

E:\go\src\golang.org\x\sys\windows\exec_windows.go:94:28: cannot use buf[:n] (type []uint16) as type *uint16 in argument to UTF16ToString
  E:\go\src\golang.org\x\sys\windows\security_windows.go:50:26: cannot use b[:n] (type []uint16) as type *uint16 in argument to UTF16ToString
  E:\go\src\golang.org\x\sys\windows\security_windows.go:221:29: cannot use db (type []uint16) as type *uint16 in argument to UTF16ToString
  E:\go\src\golang.org\x\sys\windows\security_windows.go:241:56: cannot use (*[256]uint16)(unsafe.Pointer(s))[:] (type []uint16) as type *uint16 in argument to UTF16ToString
  E:\go\src\golang.org\x\sys\windows\security_windows.go:278:24: cannot use b (type []uint16) as type *uint16 in argument to UTF16ToString
  E:\go\src\golang.org\x\sys\windows\security_windows.go:278:42: cannot use db (type []uint16) as type *uint16 in argument to UTF16ToString
  E:\go\src\golang.org\x\sys\windows\security_windows.go:460:24: cannot use b (type []uint16) as type *uint16 in argument to UTF16ToString
  E:\go\src\golang.org\x\sys\windows\syscall_windows.go:86:14: cannot range over s (type *uint16)
  E:\go\src\golang.org\x\sys\windows\syscall_windows.go:88:9: cannot slice s (type *uint16)
  E:\go\src\golang.org\x\sys\windows\syscall_windows.go:92:28: cannot use s (type *uint16) as type []uint16 in argument to utf16.Decode
  E:\go\src\golang.org\x\sys\windows\syscall_windows.go:92:28: too many errors
cnchef commented 3 years ago

The reason for this is that the golang sys package must be kept up to date go get -u golang.org/x/sys or https://github.com/golang/sys/archive/master.zip