Try specifying ‘SRCCOPY | CAPTUREBLT’ in your BitBlt or StretchBlt calls.
If it does not help, then try calling DwmGetWindowAttribute(…, DWMWA_EXTENDED_FRAME_BOUNDS, …). It should return the rectangle without the black borders. Also use PhysicalToLogicalPointForPerMonitorDPI to convert the coordinates.
Check an example in C# that can be done in C++: https://learn.microsoft.com/en-us/answers/questions/522265/.