Fixed up more LPCWSTR->LPWSTR conversion, including some code simplification.

This commit is contained in:
Pietro Gagliardi 2014-08-01 18:30:07 -04:00
parent 80828b8a7d
commit b31ce95b33
2 changed files with 4 additions and 10 deletions

View File

@ -6,12 +6,13 @@ import (
"fmt"
"io/ioutil"
"syscall"
"unsafe"
)
// #include "winapi_windows.h"
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
/*
@ -39,19 +40,13 @@ func initCommonControls() (err error) {
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 {
return fmt.Errorf("error actually initializing comctl32.dll: %s: %v", C.GoString(errmsg), syscall.Errno(errcode))
}
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"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity

View File

@ -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))
datum := d.Index(int(row)).Field(int(col))
s := fmt.Sprintf("%v", datum)
// TODO get rid of conversions
*str = C.LPWSTR(unsafe.Pointer(toUTF16(s)))
*str = toUTF16(s)
}