win32

package
v0.0.0-...-be4b657 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WKE_LBUTTON  = 0x01
	WKE_RBUTTON  = 0x02
	WKE_SHIFT    = 0x04
	WKE_CONTROL  = 0x08
	WKE_MBUTTON  = 0x10
	WKE_EXTENDED = 0x0100
	WKE_REPEAT   = 0x4000
)
View Source
const (
	MB_SETTING_PROXY            mbSettingMask = 1
	MB_ENABLE_NODEJS            mbSettingMask = 1 << 3
	MB_ENABLE_DISABLE_H5VIDEO   mbSettingMask = 1 << 4
	MB_ENABLE_DISABLE_PDFVIEW   mbSettingMask = 1 << 5
	MB_ENABLE_DISABLE_CC        mbSettingMask = 1 << 6
	MB_ENABLE_ENABLE_EGLGLES2   mbSettingMask = 1 << 7
	MB_ENABLE_ENABLE_SWIFTSHAER mbSettingMask = 1 << 8
)
View Source
const (
	WKE_LOADING_SUCCEEDED wkeLoadingResult = 0
	WKE_LOADING_FAILED    wkeLoadingResult = 1
	WKE_LOADING_CANCELED  wkeLoadingResult = 2
)
View Source
const (
	WKE_NAVIGATION_TYPE_LINKCLICK     wkeNavigationType = 0
	WKE_NAVIGATION_TYPE_FORMSUBMITTE  wkeNavigationType = 1
	WKE_NAVIGATION_TYPE_BACKFORWARD   wkeNavigationType = 2
	WKE_NAVIGATION_TYPE_RELOAD        wkeNavigationType = 3
	WKE_NAVIGATION_TYPE_FORMRESUBMITT wkeNavigationType = 4
	WKE_NAVIGATION_TYPE_OTHER         wkeNavigationType = 5
)
View Source
const (
	PROCESS_CREATE_PROCESS            = 0x0080
	PROCESS_CREATE_THREAD             = 0x0002
	PROCESS_DUP_HANDLE                = 0x0040
	PROCESS_QUERY_INFORMATION         = 0x0400
	PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
	PROCESS_SET_INFORMATION           = 0x0200
	PROCESS_SET_QUOTA                 = 0x0100
	PROCESS_SUSPEND_RESUME            = 0x0800
	PROCESS_TERMINATE                 = 0x0001
	PROCESS_VM_OPERATION              = 0x0008
	PROCESS_VM_READ                   = 0x0010
	PROCESS_VM_WRITE                  = 0x0020

	PROCESS_ALL_ACCESS = (PROCESS_CREATE_PROCESS | PROCESS_CREATE_THREAD | PROCESS_DUP_HANDLE | PROCESS_QUERY_INFORMATION | PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_SET_INFORMATION | PROCESS_SET_QUOTA | PROCESS_SUSPEND_RESUME | PROCESS_TERMINATE | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ)

	GENERIC_WRITE         = 0x40000000
	FILE_SHARE_WRITE      = 0x00000002
	CREATE_ALWAYS         = 0x2
	FILE_ATTRIBUTE_NORMAL = 0x80

	MiniDumpNormal                         = 0x00000000
	MiniDumpWithDataSegs                   = 0x00000001
	MiniDumpWithFullMemory                 = 0x00000002
	MiniDumpWithHandleData                 = 0x00000004
	MiniDumpFilterMemory                   = 0x00000008
	MiniDumpScanMemory                     = 0x00000010
	MiniDumpWithUnloadedModules            = 0x00000020
	MiniDumpWithIndirectlyReferencedMemory = 0x00000040
	MiniDumpFilterModulePaths              = 0x00000080
	MiniDumpWithProcessThreadData          = 0x00000100
	MiniDumpWithPrivateReadWriteMemory     = 0x00000200
	MiniDumpWithoutOptionalData            = 0x00000400
	MiniDumpWithFullMemoryInfo             = 0x00000800
	MiniDumpWithThreadInfo                 = 0x00001000
	MiniDumpWithCodeSegs                   = 0x00002000
	MiniDumpWithoutAuxiliaryState          = 0x00004000
	MiniDumpWithFullAuxiliaryState         = 0x00008000
	MiniDumpWithPrivateWriteCopyMemory     = 0x00010000
	MiniDumpIgnoreInaccessibleMemory       = 0x00020000
	MiniDumpWithTokenInformation           = 0x00040000
	MiniDumpWithModuleHeaders              = 0x00080000
	MiniDumpFilterTriage                   = 0x00100000
	MiniDumpWithAvxXStateContext           = 0x00200000
	MiniDumpWithIptTrace                   = 0x00400000
	MiniDumpValidTypeFlags                 = 0x007fffff
)
View Source
const (
	// Registry key security and access rights.
	// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms724878.aspx
	// for details.
	ALL_ACCESS         = 0xf003f
	CREATE_LINK        = 0x00020
	CREATE_SUB_KEY     = 0x00004
	ENUMERATE_SUB_KEYS = 0x00008
	EXECUTE            = 0x20019
	NOTIFY             = 0x00010
	QUERY_VALUE        = 0x00001
	READ               = 0x20019
	SET_VALUE          = 0x00002
	WOW64_32KEY        = 0x00200
	WOW64_64KEY        = 0x00100
	WRITE              = 0x20006
)
View Source
const (
	// Windows defines some predefined root keys that are always open.
	// An application can use these keys as entry points to the registry.
	// Normally these keys are used in OpenKey to open new keys,
	// but they can also be used anywhere a Key is required.
	CLASSES_ROOT     = Key(syscall.HKEY_CLASSES_ROOT)
	CURRENT_USER     = Key(syscall.HKEY_CURRENT_USER)
	LOCAL_MACHINE    = Key(syscall.HKEY_LOCAL_MACHINE)
	USERS            = Key(syscall.HKEY_USERS)
	CURRENT_CONFIG   = Key(syscall.HKEY_CURRENT_CONFIG)
	PERFORMANCE_DATA = Key(syscall.HKEY_PERFORMANCE_DATA)
)

Variables

View Source
var (
	DllName = "node"
	// TempPath 临时目录,用于存放临时文件如:dll,cookie等
	TempPath = filepath.Join(os.TempDir(), "blink")
)

Functions

func CloseWindows

func CloseWindows() uintptr

func Debug

func Debug() bool

func GetBound

func GetBound(h win.HWND) win.RECT

func GetFocus

func GetFocus() win.HWND

func LoadIconFromBytes

func LoadIconFromBytes(iconData []byte)

LoadIconFromBytes 先把ico二进制数据存到本地(common.TempPath),再使用winapi的LoadImage加载图标

func PtrToUtf8

func PtrToUtf8(ptr uintptr) string

func SetDebugMode

func SetDebugMode()

func SetTop

func SetTop(hWnd win.HWND)

func StartBlinkMain

func StartBlinkMain(url, title, devtoolsPath string, max, mb, ib bool, width, height int) error

func StrPtr

func StrPtr(s string) (uintptr, error)

func StrToCharPtr

func StrToCharPtr(str string) uintptr

Types

type Blink struct {
	// contains filtered or unexported fields
}
var (
	WebView *Blink
)

func (*Blink) Init

func (b *Blink) Init() *Blink

func (*Blink) WkeCreateWebView

func (b *Blink) WkeCreateWebView() WkeHandle

func (*Blink) WkeDestroyWebView

func (b *Blink) WkeDestroyWebView(wke WkeHandle)

func (*Blink) WkeOnAlertBox

func (b *Blink) WkeOnAlertBox(wke WkeHandle, callback WkeOnAlertBoxCallback, param uintptr)

func (*Blink) WkeOnDocumentReady

func (b *Blink) WkeOnDocumentReady(wke WkeHandle, callback WkeDocumentReady2Callback, param uintptr)

func (*Blink) WkeOnDownload

func (b *Blink) WkeOnDownload(wke WkeHandle, callback WkeOnDownloadCallback, param uintptr)

func (*Blink) WkeOnPaintUpdated

func (b *Blink) WkeOnPaintUpdated(wke WkeHandle, callback WkePaintUpdatedCallback, param uintptr)

func (*Blink) WkeSetDebugConfig

func (b *Blink) WkeSetDebugConfig(wke WkeHandle, debug DebugType, param string)

设置一些实验性选项。debugString可用参数有:

func (*Blink) WkeSetHandle

func (b *Blink) WkeSetHandle(wke WkeHandle, handle uintptr)

func (*Blink) WkeSetNavigationToNewWindowEnable

func (b *Blink) WkeSetNavigationToNewWindowEnable(wke WkeHandle, bl bool)

func (*Blink) WkeSetTransparent

func (b *Blink) WkeSetTransparent(wke WkeHandle, enable bool)

func (*Blink) WkeSetUserAgent

func (b *Blink) WkeSetUserAgent(wke WkeHandle, userAgent string)

func (*Blink) WkeUnInit

func (b *Blink) WkeUnInit()

type BlinkView

type BlinkView struct {
	Proc uintptr

	DevtoolsPath string
	// contains filtered or unexported fields
}

func (*BlinkView) Close

func (v *BlinkView) Close()

func (*BlinkView) Init

func (v *BlinkView) Init(userAgent string)

func (*BlinkView) LoadUrl

func (v *BlinkView) LoadUrl(url string)

func (*BlinkView) OnWndProc

func (v *BlinkView) OnWndProc(hWnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr

func (*BlinkView) SetOnNewWindow

func (v *BlinkView) SetOnNewWindow(callback WkeOnCreateViewCallback)

func (*BlinkView) WkeLoadUrlBeginCallback

func (v *BlinkView) WkeLoadUrlBeginCallback(wke WkeHandle, param, utf8Url uintptr, job WkeNetJob) uintptr

type DebugType

type DebugType string

type FinishCallback

type FinishCallback func(url string, success bool)

type FormProfile

type FormProfile struct {
	Title        string
	UserAgent    string
	Width        int
	Height       int
	Max          bool
	Mb           bool
	Ib           bool
	Index        string
	DevtoolsPath string
	Subs         map[string]FormProfile
	Main         bool
}

func (FormProfile) NewBlinkWindow

func (fp FormProfile) NewBlinkWindow()

type JsExecState

type JsExecState uintptr

type Key

type Key syscall.Handle

Key is a handle to an open Windows registry key. Keys can be obtained by calling OpenKey; there are also some predefined root keys such as CURRENT_USER. Keys can be used directly in the Windows API.

func OpenKey

func OpenKey(k Key, path string, access uint32) (Key, error)

OpenKey opens a new key with path name relative to key k. It accepts any open key, including CURRENT_USER and others, and returns the new key and an error. The access parameter specifies desired access rights to the key to be opened.

func (Key) Close

func (k Key) Close() error

Close closes open key k.

func (Key) HaveSubKey

func (k Key) HaveSubKey(name string) (bool, error)

type MbSettings

type MbSettings struct {
	Mask mbSettingMask
	// contains filtered or unexported fields
}

type ProxyInfo

type ProxyInfo struct {
	Type     ProxyType
	HostName string
	Port     int
	UserName string
	Password string
}

type ProxyType

type ProxyType int
const (
	ProxyType_NONE ProxyType = iota
	ProxyType_HTTP
	ProxyType_SOCKS4
	ProxyType_SOCKS4A
	ProxyType_SOCKS5
	ProxyType_SOCKS5HOSTNAME
)

type SaveCallback

type SaveCallback func(url, path string)

type WindowType

type WindowType int
const (
	WKE_WINDOW_TYPE_POPUP WindowType = iota
	WKE_WINDOW_TYPE_TRANSPARENT
	WKE_WINDOW_TYPE_CONTROL
)

type WkeConsoleCallback

type WkeConsoleCallback func(wke WkeHandle, param uintptr, level int32, msg, name uintptr, line uint32, stack uintptr) uintptr

type WkeDidCreateScriptContextCallback

type WkeDidCreateScriptContextCallback func(wke WkeHandle, param uintptr, frame WkeFrame, context uintptr, exGroup, worldId int) uintptr

type WkeDocumentReady2Callback

type WkeDocumentReady2Callback func(wke WkeHandle, param uintptr, frame WkeFrame) uintptr

type WkeFrame

type WkeFrame uintptr

type WkeHandle

type WkeHandle uintptr

type WkeLoadUrlBeginCallback

type WkeLoadUrlBeginCallback func(wke WkeHandle, param, utf8Url uintptr, job WkeNetJob) uintptr

type WkeLoadUrlEndCallback

type WkeLoadUrlEndCallback func(wke WkeHandle, param, url uintptr, job WkeNetJob, buf uintptr, len int32) uintptr

type WkeLoadUrlFailCallback

type WkeLoadUrlFailCallback func(wke WkeHandle, param, url uintptr, job WkeNetJob) uintptr

type WkeLoadingFinishCallback

type WkeLoadingFinishCallback func(wke WkeHandle, param uintptr, frame WkeFrame, url uintptr, result wkeLoadingResult, reason uintptr) uintptr

type WkeNetJob

type WkeNetJob uintptr

type WkeNetResponseCallback

type WkeNetResponseCallback func(wke WkeHandle, param, utf8Url uintptr, job WkeNetJob) uintptr

type WkeOnAlertBoxCallback

type WkeOnAlertBoxCallback func(wke WkeHandle, param uintptr, msg uintptr) uintptr

type WkeOnCreateViewCallback

type WkeOnCreateViewCallback func(wke WkeHandle, param uintptr, naviType wkeNavigationType, url uintptr, feature uintptr) uintptr

type WkeOnDownloadCallback

type WkeOnDownloadCallback func(wke WkeHandle, param uintptr, length uint32, url, mime, disposition uintptr, job WkeNetJob, dataBind uintptr) wkeDownloadOpt

type WkePaintBitUpdatedCallback

type WkePaintBitUpdatedCallback func(wke WkeHandle, param, buf uintptr, rect *wkeRect, width, height int32) uintptr

type WkePaintUpdatedCallback

type WkePaintUpdatedCallback func(wke WkeHandle, param, hdc uintptr, left, top, width, height int32) uintptr

type WkePopupDialogSaveNameCallback

type WkePopupDialogSaveNameCallback func(ptr, filePath uintptr) uintptr

type WkeProxy

type WkeProxy struct {
	Type     int32
	HostName [100]byte
	Port     uint16
	UserName [50]byte
	Password [50]byte
}

type WkeRequestType

type WkeRequestType int

type WkeSlist

type WkeSlist struct {
	Str  uintptr
	Next uintptr
}

type WkeString

type WkeString uintptr

Jump to

Keyboard shortcuts

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