mirror of
https://gitee.com/energye/energy.git
synced 2024-12-02 03:37:48 +08:00
A: win api
This commit is contained in:
parent
2ec7d80d74
commit
be8da5ddd5
@ -401,35 +401,35 @@ func (m *TCEFChromium) CreateBrowser(window ICEFWindowParent, windowName string,
|
||||
if !m.IsValid() {
|
||||
return false
|
||||
}
|
||||
var (
|
||||
windowParent uintptr
|
||||
windowNamePtr uintptr
|
||||
contextPtr uintptr
|
||||
extraInfoPtr uintptr
|
||||
)
|
||||
if window != nil {
|
||||
windowParent = m.Instance()
|
||||
}
|
||||
if windowName != "" {
|
||||
windowNamePtr = api.PascalStr(windowName)
|
||||
}
|
||||
if context != nil && context.IsValid() {
|
||||
contextPtr = context.Instance()
|
||||
}
|
||||
if extraInfo != nil && extraInfo.IsValid() {
|
||||
extraInfoPtr = extraInfo.Instance()
|
||||
}
|
||||
return _CEFChromium_CreateBrowse(m.Instance(), windowParent, windowNamePtr, contextPtr, extraInfoPtr)
|
||||
//if window == nil {
|
||||
// return _CEFChromium_CreateBrowse(m.Instance(), windowParent, windowNamePtr, contextPtr, extraInfoPtr)
|
||||
//} else {
|
||||
// if window.Type() == Wht_WindowParent {
|
||||
// return _CEFChromium_CreateBrowseByWindow(m.Instance(), window.Instance())
|
||||
// } else if window.Type() == Wht_LinkedWindowParent {
|
||||
// return _CEFChromium_CreateBrowseByLinkedWindow(m.Instance(), window.Instance())
|
||||
// }
|
||||
//var (
|
||||
// windowParent uintptr
|
||||
// windowNamePtr uintptr
|
||||
// contextPtr uintptr
|
||||
// extraInfoPtr uintptr
|
||||
//)
|
||||
//if window != nil {
|
||||
// windowParent = m.Instance()
|
||||
//}
|
||||
//return false
|
||||
//if windowName != "" {
|
||||
// windowNamePtr = api.PascalStr(windowName)
|
||||
//}
|
||||
//if context != nil && context.IsValid() {
|
||||
// contextPtr = context.Instance()
|
||||
//}
|
||||
//if extraInfo != nil && extraInfo.IsValid() {
|
||||
// extraInfoPtr = extraInfo.Instance()
|
||||
//}
|
||||
//return _CEFChromium_CreateBrowse(m.Instance(), windowParent, windowNamePtr, contextPtr, extraInfoPtr)
|
||||
//if window == nil {
|
||||
//return _CEFChromium_CreateBrowse(m.Instance(), windowParent, windowNamePtr, contextPtr, extraInfoPtr)
|
||||
//} else {
|
||||
if window.Type() == Wht_WindowParent {
|
||||
return _CEFChromium_CreateBrowseByWindow(m.Instance(), window.Instance())
|
||||
} else if window.Type() == Wht_LinkedWindowParent {
|
||||
return _CEFChromium_CreateBrowseByLinkedWindow(m.Instance(), window.Instance())
|
||||
}
|
||||
//}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *TCEFChromium) CreateBrowserByBrowserViewComponent(homePage string, browserViewComponent *TCEFBrowserViewComponent) bool {
|
||||
|
@ -216,6 +216,15 @@ const (
|
||||
CEF_Win_TextOut
|
||||
CEF_Win_UpdateWindow
|
||||
CEF_Win_WindowFromPoint
|
||||
CEF_Win_GetWindowLongPtr
|
||||
CEF_Win_SetWindowLongPtr
|
||||
CEF_Win_GetClassLongPtr
|
||||
CEF_Win_SetClassLongPtr
|
||||
CEF_Win_FindWindow
|
||||
CEF_Win_FindWindowEx
|
||||
CEF_Win_SetWindowText
|
||||
CEF_Win_GetWindowText
|
||||
CEF_Win_GetWindowTextLength
|
||||
// TCefBaseRefCounted
|
||||
CefBaseRefCounted_Wrap
|
||||
CefBaseRefCounted_Free
|
||||
|
@ -215,6 +215,15 @@ func init() {
|
||||
dllimports.NewEnergyImport("CEF_Win_TextOut", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_UpdateWindow", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_WindowFromPoint", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_GetWindowLongPtr", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_SetWindowLongPtr", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_GetClassLongPtr", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_SetClassLongPtr", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_FindWindow", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_FindWindowEx", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_SetWindowText", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_GetWindowText", 0),
|
||||
dllimports.NewEnergyImport("CEF_Win_GetWindowTextLength", 0),
|
||||
//TCEFBaseRefCountedRef
|
||||
dllimports.NewEnergyImport("CefBaseRefCounted_Wrap", 0),
|
||||
dllimports.NewEnergyImport("CefBaseRefCounted_Free", 0),
|
||||
|
69
cef/winapi/def-win-api_windows.go
Normal file
69
cef/winapi/def-win-api_windows.go
Normal file
@ -0,0 +1,69 @@
|
||||
//----------------------------------------
|
||||
//
|
||||
// Copyright © yanghy. All Rights Reserved.
|
||||
//
|
||||
// Licensed under Apache License Version 2.0, January 2004
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
//----------------------------------------
|
||||
|
||||
// Package winapi energy - lcl window api
|
||||
// export in Lazarus ascdef.inc
|
||||
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package winapi
|
||||
|
||||
import (
|
||||
"github.com/energye/energy/v2/cef/internal/def"
|
||||
"github.com/energye/energy/v2/common/imports"
|
||||
"github.com/energye/energy/v2/types"
|
||||
"github.com/energye/golcl/lcl/api"
|
||||
)
|
||||
|
||||
func WinGetWindowLongPtr(hWnd types.HWND, nIndex types.LongInt) types.LongPtr {
|
||||
r1, _, _ := imports.Proc(def.CEF_Win_GetWindowLongPtr).Call(uintptr(hWnd), uintptr(nIndex))
|
||||
return types.LongPtr(r1)
|
||||
}
|
||||
|
||||
func WinSetWindowLongPtr(hWnd types.HWND, nIndex types.LongInt, dwNewLong types.LongPtr) types.LongPtr {
|
||||
r1, _, _ := imports.Proc(def.CEF_Win_SetWindowLongPtr).Call(uintptr(hWnd), uintptr(nIndex), uintptr(dwNewLong))
|
||||
return types.LongPtr(r1)
|
||||
}
|
||||
|
||||
func WinGetClassLongPtr(hWnd types.HWND, nIndex types.LongInt) types.LongPtr {
|
||||
r1, _, _ := imports.Proc(def.CEF_Win_GetClassLongPtr).Call(uintptr(hWnd), uintptr(nIndex))
|
||||
return types.LongPtr(r1)
|
||||
}
|
||||
|
||||
func WinSetClassLongPtr(hWnd types.HWND, nIndex types.LongInt, dwNewLong types.LongPtr) types.LongPtr {
|
||||
r1, _, _ := imports.Proc(def.CEF_Win_GetClassLongPtr).Call(uintptr(hWnd), uintptr(nIndex), uintptr(dwNewLong))
|
||||
return types.LongPtr(r1)
|
||||
}
|
||||
|
||||
func WinFindWindow(lpClassName string, lpWindowName string) types.HWND {
|
||||
r1, _, _ := imports.Proc(def.CEF_Win_GetClassLongPtr).Call(api.PascalStr(lpClassName), api.PascalStr(lpWindowName))
|
||||
return types.HWND(r1)
|
||||
}
|
||||
|
||||
func WinFindWindowEx(_para1 types.HWND, _para2 types.HWND, _para3 string, _para4 string) types.HWND {
|
||||
r1, _, _ := imports.Proc(def.CEF_Win_GetClassLongPtr).Call(uintptr(_para1), uintptr(_para2), api.PascalStr(_para3), api.PascalStr(_para4))
|
||||
return types.HWND(r1)
|
||||
}
|
||||
|
||||
func WinSetWindowText(hWnd types.HWND, lpString string) types.LongBool {
|
||||
r1, _, _ := imports.Proc(def.CEF_Win_GetClassLongPtr).Call(uintptr(hWnd), api.PascalStr(lpString))
|
||||
return types.LongBool(api.GoBool(r1))
|
||||
}
|
||||
|
||||
func WinGetWindowText(hWnd types.HWND, lpString string, nMaxCount types.LongInt) types.LongInt {
|
||||
r1, _, _ := imports.Proc(def.CEF_Win_GetClassLongPtr).Call(uintptr(hWnd), api.PascalStr(lpString), uintptr(nMaxCount))
|
||||
return types.LongInt(r1)
|
||||
}
|
||||
|
||||
func WinGetWindowTextLength(hWnd types.HWND) types.LongInt {
|
||||
r1, _, _ := imports.Proc(def.CEF_Win_GetClassLongPtr).Call(uintptr(hWnd))
|
||||
return types.LongInt(r1)
|
||||
}
|
@ -38,6 +38,7 @@ type AnsiChar = Char
|
||||
type TCefColor = UInt32
|
||||
type Integer = Int32
|
||||
type LongInt = Int32
|
||||
type LongPtr = UIntptr
|
||||
type LongWord = UInt32
|
||||
type NativeUInt = UInt32
|
||||
type TCefString = String
|
||||
|
Loading…
Reference in New Issue
Block a user