mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
Merge pull request #513 from go-vgo/bitmap-pr
add get the HWND by PID support
This commit is contained in:
commit
db2eda3e1f
@ -236,6 +236,11 @@ func getNumDisplays() int {
|
|||||||
return int(C.get_num_displays())
|
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
|
// SysScale get the sys scale
|
||||||
func SysScale(displayId ...int) float64 {
|
func SysScale(displayId ...int) float64 {
|
||||||
display := displayIdx(displayId...)
|
display := displayIdx(displayId...)
|
||||||
|
@ -97,6 +97,15 @@ uint32_t get_num_displays() {
|
|||||||
#endif
|
#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) {
|
void bitmap_dealloc(MMBitmapRef bitmap) {
|
||||||
if (bitmap != NULL) {
|
if (bitmap != NULL) {
|
||||||
destroyMMBitmap(bitmap);
|
destroyMMBitmap(bitmap);
|
||||||
|
Loading…
Reference in New Issue
Block a user