Win32/Gdigrab - 如何将另一个进程 window 设置为无边界?

Win32/Gdigrab - How to set another process window as borderless?

我目前正在使用 GDIGRAB 捕捉 window。问题是,因为边框,鼠标光标在它的位置上有一个偏移量。

想法是将 window 设置为无边界,这样偏移就不会再出现了。鉴于目标进程的句柄,我如何将 window 从 windowed 更改为无边界?

不要修改其他进程'windows。相反,获取边框偏移量。

HWND window = ...;
RECT wndRect, clientRect;
GetWindowRect(window,&wndRect);
GetClientRect(window,&clientRect);
POINT borderOffset={clientRect.left,clientRect.top};
ClientToScreen(window,&borderOffset);
borderOffset.x-=wndRect.left;
borderOffset.y-=wndRect.top;
// borderOffset now contains the x and y offsets for the window