add get the HWND by PID support

This commit is contained in:
vcaesar 2022-06-26 10:23:17 -07:00
parent 1934220f50
commit ee25e577e5
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);