browser

package module
v0.0.0-...-ff9a39a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 3 Imported by: 1

README

概述

基于win32API和miniblink封装的GOLANG使用的WebUI,使用原生窗体加内嵌视图的方式实现。目前已完成常用接口封装,后续会逐步完善。 直接调用DLL,未使用CGO。


miniblink是一个开源的、单文件、且目前已知的最小的基于chromium的,浏览器控件。 通过其导出的纯C接口,几行代码即可创建一个浏览器控件。 您可以通过官网http://miniblink.net 来获取更多的关于miniblink的信息。

使用前准备

普通版本可以自行到 https://github.com/weolar/miniblink49/releases 下载最新编译后的 dll 替换就行。 VIP版本需进行购买https://miniblink.net/views/features.html

注意

  1. 下载的名称默认是 node.dll,需跟代码中function.go中dll_name值一致)。
  2. 默认代码版本为VIP接口,普通接口可以自行修改function.go中加载函数名将mb前缀改为wke。

使用

创建一个加载指定链接的窗口:

func main() {
	defer log.CatchPanic("main")
	url := flag.String("url", "https://www.baidu.com", "链接")
	title := flag.String("title", "aa", "标题")
	noTitles := flag.String("noHead", "[]", "无标题域名")
	ico := flag.String("icon", "", "图标")
	dev := flag.String("dev", "", "调试目录")
	ua := flag.String("ua", "", "UserAgent")
	max := flag.Bool("max", true, "初始最大化")
	width := flag.Int("width", 1600, "宽")
	height := flag.Int("height", 900, "高")
	flag.Parse()
	var domains []string
	err := json.Unmarshal([]byte(*noTitles), &domains)
	if err != nil {
		return
	}
	userAgent = *ua
	if len(*url) == 0 {
		return
	}
	jsFunc := map[int32]func(string) string{
		1: func(sha string) string {
			s := string(findOne(sha, keyTable))
			return s
		},
	}
	err = browser.StartFull(*url, *title, *ico, userAgent, *dev, *max, true, true, true, *width, *height, thuOS.Center, finish, save, jsFunc, nil, nil, nil, domains)
	if err != nil {
		log.Log(*title+":"+*url, err.Error())
	}
}

具体可参考demo文件夹下文件


感谢

Jetbrains提供Goland开发工具

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunNoWindow

func RunNoWindow(ico, title, ua, devPath string, max, mb, ib bool, width, height int,
	jsFunc map[int32]func(string) string, set func(uintptr)) error

func Show

func Show(url, script string, x, y int32)

func Start

func Start(url, title, ico, ua, devPath string, max bool, width, height int) error

func StartFull

func StartFull(url, title, ico, ua, devPath string, max, mb, ib, show bool, width, height, pos int, finish win32.FinishCallback, save win32.SaveCallback,
	jsFunc map[int32]func(string) string, forms map[string]win32.FormProfile, set, close func(uintptr), domains []string) error

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL