美文网首页📙Go语言:进阶大全
Go语言:获取Windows屏幕分辨率

Go语言:获取Windows屏幕分辨率

作者: 白祤星 | 来源:发表于2019-03-24 18:39 被阅读2891次

代码示例


package main

import "syscall"

func GetSystemMetrics(nIndex int) int {
    ret, _, _ := syscall.NewLazyDLL(`User32.dll`).NewProc(`GetSystemMetrics`).Call(uintptr(nIndex))
    return int(ret)
}

func main() {
    println(`宽度:`)
    println(GetSystemMetrics(0))
    println(`高度:`)
    println(GetSystemMetrics(1))
}

相关文章

网友评论

    本文标题:Go语言:获取Windows屏幕分辨率

    本文链接:https://www.haomeiwen.com/subject/hnauvqtx.html