mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 05:00:31 +08:00
[v2, windows] Make SetBackgroundColour compatible for windows/386 (#1493)
* [v2, windows] Remove duplicate SetBackgroundColour * [v2, windows] Make SetBackgroundColour compatible for windows/386
This commit is contained in:
parent
16581ceff9
commit
c61ce1e2de
@ -15,6 +15,7 @@ var (
|
||||
moduser32 = syscall.NewLazyDLL("user32.dll")
|
||||
procSystemParametersInfo = moduser32.NewProc("SystemParametersInfoW")
|
||||
procGetWindowLong = moduser32.NewProc("GetWindowLongW")
|
||||
procSetClassLong = moduser32.NewProc("SetClassLongW")
|
||||
procSetClassLongPtr = moduser32.NewProc("SetClassLongPtrW")
|
||||
procShowWindow = moduser32.NewProc("ShowWindow")
|
||||
)
|
||||
|
@ -4,10 +4,12 @@ package win32
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc"
|
||||
"log"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -119,7 +121,19 @@ func dwmExtendFrameIntoClientArea(hwnd uintptr, margins *MARGINS) error {
|
||||
}
|
||||
|
||||
func setClassLongPtr(hwnd uintptr, param int32, val uintptr) bool {
|
||||
ret, _, _ := procSetClassLongPtr.Call(
|
||||
proc := procSetClassLongPtr
|
||||
if strconv.IntSize == 32 {
|
||||
/*
|
||||
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setclasslongptrw
|
||||
Note: To write code that is compatible with both 32-bit and 64-bit Windows, use SetClassLongPtr.
|
||||
When compiling for 32-bit Windows, SetClassLongPtr is defined as a call to the SetClassLong function
|
||||
|
||||
=> We have to do this dynamically when directly calling the DLL procedures
|
||||
*/
|
||||
proc = procSetClassLong
|
||||
}
|
||||
|
||||
ret, _, _ := proc.Call(
|
||||
hwnd,
|
||||
uintptr(param),
|
||||
val,
|
||||
|
@ -86,10 +86,6 @@ func NewWindow(parent winc.Controller, appoptions *options.App, versionInfo *ope
|
||||
result.theme = winoptions.SystemDefault
|
||||
}
|
||||
|
||||
if appoptions.BackgroundColour != nil {
|
||||
win32.SetBackgroundColour(result.Handle(), appoptions.BackgroundColour.R, appoptions.BackgroundColour.G, appoptions.BackgroundColour.B)
|
||||
}
|
||||
|
||||
result.SetSize(appoptions.Width, appoptions.Height)
|
||||
result.SetText(appoptions.Title)
|
||||
result.EnableSizable(!appoptions.DisableResize)
|
||||
|
Loading…
Reference in New Issue
Block a user