golang —调用window api函数执行程序

golang ---调用window api函数执行程序
强烈推介IDEA2021.1.3破解激活,IntelliJ IDEA 注册码,2021.1.3IDEA 激活码 

大家好,我是架构君,一个会写代码吟诗的架构师。今天说一说golang ---调用window api函数执行程序,希望能够帮助大家进步!!!

package main
import "syscall"
import "unsafe"
func main() {	var hand uintptr = uintptr(0)	var operator uintptr = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr("open")))	var fpath uintptr = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr("D:\\GOPATH\\src\\data.go\\data.go.exe")))	var param uintptr = uintptr(0)	var dirpath uintptr = uintptr(0)	var ncmd uintptr = uintptr(1)	shell32 := syscall.NewLazyDLL("shell32.dll")	ShellExecuteW := shell32.NewProc("ShellExecuteW")	_, _, _ = ShellExecuteW.Call(hand, operator, fpath, param, dirpath, ncmd)
}

  

转载于:https://www.cnblogs.com/saryli/p/11119368.html

本文来源weixin_30595035,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/29719

发表评论