Merge pull request #513 from go-vgo/bitmap-pr

add get the HWND by PID support
This commit is contained in:
Evans 2022-06-26 10:25:08 -07:00 committed by GitHub
commit db2eda3e1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -236,6 +236,11 @@ func getNumDisplays() int {
return int(C.get_num_displays())
}
// GetHwndByPId get the hwnd by pid
func GetHwndByPId(pid int) int {
return int(C.get_hwnd_by_pid(C.uintptr(pid)))
}
// SysScale get the sys scale
func SysScale(displayId ...int) float64 {
display := displayIdx(displayId...)

View File

@ -97,6 +97,15 @@ uint32_t get_num_displays() {
#endif
}
uintptr get_hwnd_by_pid(uintptr pid) {
#if defined(IS_WINDOWS)
HWND hwnd = GetHwndByPId(pid);
return (uintptr)hwnd;
#else
return 0;
#endif
}
void bitmap_dealloc(MMBitmapRef bitmap) {
if (bitmap != NULL) {
destroyMMBitmap(bitmap);