ai micro, i am not sure if it will actually help you, but this should be the relevant code:
procedure TMex9ScreenshotNode.UpdateTextureCB(texture: TMex9Texture;
devicetexture: TMex9DynamicDeviceTexture; Slice: Integer);
var
hr: HResult;
good: Boolean;
sTarget: IDirect3DSurface9;
sR: TRect;
tDC, sDC: HDC;
r: TRect;
MrCursor: TIcon;
IconInfo: TIconInfo;
canvas: TCanvas;
h: HWND;
begin
h := FHandlePin.AsPositiveInteger0[Slice](Slice);
good := GetShotRect(Slice, r);
if good then
begin
case FModePin[Slice](Slice) of
ord(ssmWindowAreaOfHandle), ord(ssmWindowOfHandle): sDC := GetWindowDC(h);
ord(ssmClientAreaOfHandle), ord(ssmClientOfHandle): sDC := GetDC(h);
ord(ssmRectangle): sDC := GetDC(0); //desktop
end;
try
hr := devicetexture.TextureI.GetSurfaceLevel(0, sTarget);
hr := sTarget.GetDC(tDC);
case FModePin[Slice](Slice) of
0, 1: BitBlt(tDC, 0, 0, r.right, r.bottom, sDC, 0, 0, SRCCOPY);
2: BitBlt(tDC, 0, 0, r.right, r.bottom, sDC, r.left, r.top, SRCCOPY);
3:
begin
//todo: send message to all controls recursivly
//SendMessage(FHandle.AsPositiveInteger0[i](i), WM_ERASEBKGND, Integer(tDC), 0);
//SendMessage(FHandle.AsPositiveInteger0[i](i), WM_PAINT, Integer(tDC), 0);
SendMessage(h, WM_PRINT, tDC, PRF_CHILDREN + PRF_CLIENT + PRF_ERASEBKGND + PRF_NONCLIENT + PRF_OWNED);
end;
4:
begin
//todo: send message to all controls recursivly
SendMessage(h, WM_PRINTCLIENT, tDC, PRF_CHILDREN + PRF_CLIENT + PRF_ERASEBKGND + PRF_OWNED);
end;
end;
ReleaseDC(h, sDC);
if FShowCursorPin.AsBool[Slice](Slice) then
begin
MrCursor := TIcon.Create;
MrCursor.Width := GetSystemMetrics(SM_CXCURSOR);
MrCursor.Height := GetSystemMetrics(SM_CYCURSOR);
try
MrCursor.Handle := GetCursorHandle; // GetCursor;
if MrCursor.Handle > 0 then
begin
GetIconInfo(MrCursor.Handle, IconInfo);
//Draw the Cursor on the bitmap
canvas := TCanvas.Create;
canvas.handle := tDC;
canvas.Draw(Mouse.CursorPos.X - IconInfo.xHotspot - r.Left, Mouse.CursorPos.Y - IconInfo.yHotspot - r.Top, MrCursor);
canvas.Free;
end;
finally
// Clean up
MrCursor.ReleaseHandle;
MrCursor.Free;
DeleteObject(IconInfo.hbmMask);
DeleteObject(IconInfo.hbmColor);
end;
end;
finally
sTarget.ReleaseDC(tDC);
sTarget := nil;
end;
end;
end;