Skip to content

Instantly share code, notes, and snippets.

@krpors
Created April 10, 2013 12:08
Show Gist options
  • Save krpors/5354043 to your computer and use it in GitHub Desktop.
Save krpors/5354043 to your computer and use it in GitHub Desktop.
Calling MessageBoxW in Go
package main
import (
"fmt"
"syscall"
"unsafe"
)
func main() {
fmt.Println("Done!")
user32 := syscall.NewLazyDLL("user32.dll")
proc := user32.NewProc("MessageBoxW")
str := "Hello there"
ptr, _ := syscall.UTF16PtrFromString(str)
proc.Call(0, uintptr(unsafe.Pointer(ptr)), uintptr(unsafe.Pointer(ptr)), 0x0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment