Christian Iversen wroteThe question you pose is interesting, but not really related to lazarus
at all.
It is not related to Lazarus itself but how to achieve something in Lazarus (and possibly Delphi) apps.
In a side note, not that many games use overlays. Can you tell
me what you are trying to achieve?
It is not intended specifically for games, i am trying to create a screenshot (possibly record) of everything on screen or a specific window over which i have some control. Let's say make a screenshot of the desktop with a running media player or just the media player then process that image. Because DirectShow codecs use overlays this is not possible with traditional GDI methods.
However, there are several ways one might go about doing something like
this. They are all hacky, but varying degree.
Hacky is no problem, it just has to work, many things are hacky on Windows.
Show quoted text 6 lines
A) Assume the overlay stays in place in memory (ugly)
1) Create an overlay of (approximately) the same size as the target
2) Keep the pointer to the memory location
3) Destory the overlay
4) Start the application
5) Read the stored memory position
Where do i obtain this pointer from, any links, docs ?
Show quoted text 7 lines
If you are lucky, then:
1) This position is indeed still valid
2) This position is mapped to VRAM on the graphics card
3) You will be able to read the data from there (but you
will not know when new frames arrive)
B) Create a DLL proxy (bad)
How is this done ? It is not an option for me to install anything on the system that might interfere with other activities, installing a driver or codec is not a posibillity.
Show quoted text 11 lines
1) Create a new DLL file dshow.dll (dshow9.dll?). This will
be your proxy
2) For all the functions in the real dshow.dll, use GetProcAddress()
to find the corresponding function in dshow.dll. For the overlay
functions, implement them yourself. This allows complete control
over the process. You can then do anything you want with the
overlay data.
C) Work around the need to capture the overlay (good)
1) If what you need to do is perform some action,
it might be easier to re-implement the functionality.
This would be good but it is out of my control to disable overlays, i'm at the mercy of preinstaled codecs and the people using them.
Thank you for the suggestions, i am trying out OpenSource apps that claim to do capturing from DirectX or Windows Media but none seems to work, all return the classic black rectangle in place of the clip.
Razvan