Fixed up more LPCWSTR->LPWSTR conversion, including some code simplification.
This commit is contained in:
parent
80828b8a7d
commit
b31ce95b33
|
@ -6,12 +6,13 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "winapi_windows.h"
|
// #include "winapi_windows.h"
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
|
// TODO possibly rewrite the whole file access bits in C
|
||||||
|
|
||||||
// pretty much every constant here except _WM_USER is from commctrl.h, except where noted
|
// pretty much every constant here except _WM_USER is from commctrl.h, except where noted
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -39,19 +40,13 @@ func initCommonControls() (err error) {
|
||||||
|
|
||||||
var errmsg *C.char
|
var errmsg *C.char
|
||||||
|
|
||||||
errcode := C.initCommonControls(C.LPWSTR(unsafe.Pointer(syscall.StringToUTF16Ptr(filename))), &errmsg)
|
errcode := C.initCommonControls(toUTF16(filename), &errmsg)
|
||||||
if errcode != 0 || errmsg != nil {
|
if errcode != 0 || errmsg != nil {
|
||||||
return fmt.Errorf("error actually initializing comctl32.dll: %s: %v", C.GoString(errmsg), syscall.Errno(errcode))
|
return fmt.Errorf("error actually initializing comctl32.dll: %s: %v", C.GoString(errmsg), syscall.Errno(errcode))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common Controls class names.
|
|
||||||
const (
|
|
||||||
// x (lowercase) prefix to avoid being caught by the constants generator
|
|
||||||
x_PROGRESS_CLASS = "msctls_progress32"
|
|
||||||
)
|
|
||||||
|
|
||||||
var manifest = []byte(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
var manifest = []byte(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||||
<assemblyIdentity
|
<assemblyIdentity
|
||||||
|
|
|
@ -50,6 +50,5 @@ func tableGetCellText(data unsafe.Pointer, row C.int, col C.int, str *C.LPWSTR)
|
||||||
d := reflect.Indirect(reflect.ValueOf(t.data))
|
d := reflect.Indirect(reflect.ValueOf(t.data))
|
||||||
datum := d.Index(int(row)).Field(int(col))
|
datum := d.Index(int(row)).Field(int(col))
|
||||||
s := fmt.Sprintf("%v", datum)
|
s := fmt.Sprintf("%v", datum)
|
||||||
// TODO get rid of conversions
|
*str = toUTF16(s)
|
||||||
*str = C.LPWSTR(unsafe.Pointer(toUTF16(s)))
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue