I write a screenshot (of the whole screen, not only of my form) to a TImage via the code from the accepted answer at How to take a screenshot with FireMonkey (multi-platforms) which works just fine. However I want to include the mouse cursor in the image, so I'm looking for a solution to draw the cursor over the TImage in a second step.
In a Windows VCL project the code at http://www.swissdelphicenter.ch/torry/showcode.php?id=1124 runs well and draws the cursor on a TImage. But I can't make it work in a Windows Firemonkey HD project, because of the line
Canvas.Draw(CurPoxY, CurPoxY, MyCursor);
since under Firemonkey there is no Draw method. I also tried "DrawIcon()", but it always returns False. I am trying to get this code to work in Firemonkey on Windows.
I finally got this to work. The trick is:
The DrawIcon() function (from WinAPI.Windows) doesn't work with Bitmaps of the type FMX.Types.TBitmap which the TImages now have under Firemonkey. So I had to create a temporary Bitmap of the type Vcl.Graphics.TBitmap on which I can draw the cursor icon. I than create a temporary MemoryStream and use the SaveToStream method of my temporary Bitmap to write it to that MemoryStream from which I can load it to the TImage on my form (Image1.Bitmap.LoadFromStream(TmpMemoryStream)).