It appears the result of syscall.StringToUTF16Ptr() is only temporary, so removed all that. Now the program just hangs...

This commit is contained in:
Pietro Gagliardi 2014-02-11 19:52:39 -05:00
parent 9bfe67c49d
commit cee78198e4
2 changed files with 7 additions and 7 deletions

View File

@ -7,7 +7,7 @@ import (
"unsafe" "unsafe"
) )
const ( var (
stdWndClass = "gouiwndclass" stdWndClass = "gouiwndclass"
) )
@ -57,7 +57,7 @@ type _WNDCLASS struct {
hCursor _HANDLE hCursor _HANDLE
hbrBackground _HBRUSH hbrBackground _HBRUSH
lpszMenuName *uint16 lpszMenuName *uint16
lpszClassName *uint16 lpszClassName uintptr
} }
func registerStdWndClass() (err error) { func registerStdWndClass() (err error) {
@ -83,7 +83,7 @@ func registerStdWndClass() (err error) {
cursor := _HANDLE(r1) cursor := _HANDLE(r1)
wc := &_WNDCLASS{ wc := &_WNDCLASS{
lpszClassName: syscall.StringToUTF16Ptr(stdWndClass), lpszClassName: uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(stdWndClass))),
lpfnWndProc: syscall.NewCallback(stdWndProc), lpfnWndProc: syscall.NewCallback(stdWndProc),
hInstance: hInstance, hInstance: hInstance,
hIcon: icon, hIcon: icon,

View File

@ -16,7 +16,7 @@ type sysData struct {
} }
type classData struct { type classData struct {
name uintptr name string
style uint32 style uint32
xstyle uint32 xstyle uint32
} }
@ -26,12 +26,12 @@ type classData struct {
var classTypes = [nctypes]*classData{ var classTypes = [nctypes]*classData{
c_window: &classData{ c_window: &classData{
name: uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(stdWndClass))), name: stdWndClass,
style: _WS_OVERLAPPEDWINDOW, style: _WS_OVERLAPPEDWINDOW,
xstyle: 0, xstyle: 0,
}, },
// c_button: &classData{ // c_button: &classData{
// name: uintptr(unsafe.Pointer("BUTTON")) // name: "BUTTON"
// style: _BS_PUSHBUTTON | controlstyle, // style: _BS_PUSHBUTTON | controlstyle,
// xstyle: 0 | controlxstyle, // xstyle: 0 | controlxstyle,
// }, // },
@ -48,7 +48,7 @@ func (s *sysData) make() (err error) {
call: _createWindowEx, call: _createWindowEx,
p: []uintptr{ p: []uintptr{
uintptr(ct.xstyle), uintptr(ct.xstyle),
ct.name, uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(ct.name))),
uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(s.text))), uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(s.text))),
uintptr(ct.style), uintptr(ct.style),
uintptr(_CW_USEDEFAULT), // TODO uintptr(_CW_USEDEFAULT), // TODO