Good morning all.
I'm currently attempting to write a small application that's built around the features available through the Windows DWM API (e.g. DWM Thumbnails). One such feature would be the ability to dynamically select an area of the thumbnail from within the application, and have it scaled up/zoomed in. It may be possible to do this from DWM with some sort of 'set region' function, but I wanted to try my own route first before going too far into the API.
Having recently found an example for Delphi, I had hoped to expand from the demo and build something more specific. I set about moving the code over to a Firemonkey FM2
application (as I much prefer the visual features of the framework compared to VCL). With a few tweaks, I managed to get it built, but unfortunately it seems as though DWMRegisterThumbnail
wouldn't return a valid result when running in the FMX application, despite the VCL version working flawlessly.
I then looked a little further and decided to give Hydra a shot. I copied the working VCL example over to a Hydra Plugin, and created a Firemonkey host application. I correctly set up both parts and compiled. The DLL loaded correctly and I could see the VCL plugin interface inside the FMX host as expected. However, upon trying to view the DWM Thumbnail of a window, I was once again faced with the same issue I had when running the non-hydra FMX application.
I then went about creating a VCL host application just to be sure it wasn't an issue specific to the VCL-FMX interaction. I compiled the VCL host, loaded in the VCL plugin, and again I could see the VCL plugin inside the VCL host. However once again, I was still finding that I couldn't view thumbnails from DWM. Evidently, it's not a Firemonkey-VCL interaction issue.
Therefore, I've concluded it's an issue with running the DWM code from a DLL. Ideally, I'd like to have an FMX host application simply because it's easier for me to drop a TSelection
over the thumbnail, and deal with scaling in that way (e.g. very little code, and no need to look for a custom component) not to mention the additional bonuses such as MakeScreenshot
.
So, to cut to the chase; Is it possible to call the DWM API from a Hydra Plugin, and/or output a DWM Thumbnail to a Firemonkey surface?
The code used in my Hydra Plugin is identical to that which is used in the linked example, and the code used in my host application(s) is based upon the simple example on the Remobject Youtube Channel.
DWMRegisterThumbnail
failing for your FMX app :) – David