Created
April 10, 2013 12:08
-
-
Save krpors/5354043 to your computer and use it in GitHub Desktop.
Calling MessageBoxW in Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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