mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-23 17:59:12 +00:00
add get the HWND by PID support
This commit is contained in:
parent
1934220f50
commit
ee25e577e5
2 changed files with 14 additions and 0 deletions
|
|
@ -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...)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue