返回顶部

收藏

Google Go语言调用window api函数执行程序

更多

Google Go语言通过syscall,unsafe模块访问windows api,ShellExecute

[Google Go]代码

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:\\Program Files\\TTPlayer\\TTPlayer.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);
}

标签:Go

收藏

0人收藏

支持

0

反对

0

»更多 您可能感兴趣的代码
  1. 2017-09-10 14:28:40Go语言中的指针 by lucasli
  2. 2015-09-08 17:34:56AES加密 by GauSir
  3. 2015-08-22 10:37:28文件分割 by 迟浩东
  4. 2015-08-19 12:07:40Base64加密解密 by lucasli
  5. 2017-12-11 17:37:06表变量,代替临时表 by xuleaper
  6. 2017-12-11 12:07:28触发器 by 吴红军
  7. 2017-12-11 10:50:48Python的socket编程 by 阮小七
  8. 2017-12-11 09:36:54sql中order by(true or false) 类似 group by 的方式 by YuChao
  9. 2017-12-11 09:21:56Android 调节屏幕亮度代码 by 朱凯迪
  10. 2017-12-11 09:06:40java 实现的Boyer-Moore(BM)算法 by 落叶随风
  11. 2017-12-10 16:44:19Android监听Gps设置变化方法二 by 法名空虚

发表评论