How do I record and display the output of an EXE Window into another EXE Window - lua

So for example let's say I have a game running, I want to grab the image output of the game and display it onto another window I have, so I would have two identical looking windows, one with the game itself, and one with the output of it. I want this to be done with LUA.

You can try wxwidgets library (with wxlua wrapper), as it provides access to the screen device context to read its pixels. See for example this takeScreenshot function that saves a section of the display into a PNG file.

Related

How to include cursor with page screenshot captured via Electron's capturePage API?

I’m attempting to capture a screenshot of a webview via calling its webContents’ capturePage method. I had assumed that a cursor would be included with the screenshot, but it’s not.
Any ideas on how best to achieve including a cursor with the screenshot taken via a capturePage call?
TL;DR: webContents.capturePage () won't include the cursor because the screenshot is not made on an OS-level.
Electron takes the screenshot directly after Chromium has rendered it, which is also why the rect property to the function cannot be bigger than the window's inner width and height, i.e. the window decoration, such as titlebars, etc., cannot be included in the screenshot.
What Electron does is to take the binary image data which is output to the graphics processor of your computer (and thus to your monitor), and writes it to a PNG or JPEG file.
Including OS-specific elements such as cursors or window decorations would involve a platform-specific approach (as there is no unified API to take screenshots throughout Linux, Windows and Mac OS), which creates (possibly) more dependencies and more noise. The rendering done by the Chromium engine is platform-agnostic and thus the way easier approach.

C# Newbie - Vector Printing of Visio Document using AxVisioViewer ActiveX control

I am using VS2013Express to create a windows form based application which will display and eventually print Visio documents, rather than relying on the browser based Visio Viewer. Needless to say this is a very specific requirement, so really don't need anyone telling me to use the MS Visio Viewer!
So far, I can open the Visio document, display it using the AxVisioViewer.dll control. I can even print... to a degree.
The issue is that I can only print currently using a PrintFromScreen method which basically captures the image of the form as displayed on screen and creates a Raster BitMap of it.
I copy the BitMap image to a hidden panel on the form (to remove toolbars etc), then print the contents of the panel. Simple (ish)!
Here's a link to the page I used to create the panel and print the image.
What I want to be able to do is resize (Vector not Raster to retain scale) and centre the image as required to ensure the document prints properly.
You'll want to center the drawing in the control.
Check the following link.
https://msdn.microsoft.com/en-us/vba/visio-vba/articles/viewer-zoomtorect-method-visio-viewer
You may also check the zoom and pan methods.

Delphi Fortes Report angleLabel on top, across a report

I am making the invoice part of an application, and at this moment I am done with the invoice generation (adding products and stuff).
The next step is to have a report displaying the invoice data, ready to print.
That works too. I used Fortes Reports because it is free, easy to work with, and has a free PDF export filter, and a Preview component, so it has everything I need.
Now, my problem is that I must allow my users to Annull an invoice. So when an invoice was emitted, if there was a problem with it, I cannot just delete it later, I must Annull it (I'm not sure that is how you call it - maybe make it void), but basically the invoice stays the same (in printed form) EXCEPT we must write/draw diagonally on top of the entire invoice one word: ANNULLED with RED color.
That means I will make a new report for this case (annulled invoices) and use this one whenever the user wants to print an annulled invoice
So now in Fortes Report there is an RLAngleLabel component that allows me (in theory) to do just that: draw/write the word ANNULLED on the report. But my problem is that I add the label just fine in the btDetail RLBand, only I just can't see it in Preview, and I have no idea what I am doing wrong. If it's not visible in designtime preview, I assume it wont be visible in runtime neither.
Should I place it in a specific way? Should I add it at runtime somehow? I cant seem to be able to access the report's Canvas so I could draw it in some event...
Does anyone have any experience with what I am describing?
In order to reproduce my problem, just add a RLReport control on your form, add bands to it (Titleband, ColumnHeaderBand, DetailBand), and on a detailBand (DetailGridBand)place an AngleLabel, then right click on the report and choose Preview...
If I place the AngleLabel on the TitleBand or on ColumnHeaderBand, then it shows in preview, except that I need to place this Angled label ON TOP of the contents of the invoice, not on the header info.
In the past I used a BMP image as big as the invoice (in order to have it transparent so I would see the contents beneath it), but that made my exported PDF report 5MB in size, and that is a little too much (PNG was not working correctly - I think it would not display it transparent or something like that, so I was stuck to using BMP).
Is there any way of achieving what I want (described above)?
For whoever encounters this dilema, I reached the conclusion that I should still go with displaying an image containing the desired text as background and setting the bands to Transparent.
The angleLabel approach seems to be unknown, so I dropped it.
I use this time a PNG file that is about 30-40 KB in size and that does not bother me to have it added to the size of the final PDF.
A lot better than the previous BMP image I used before (that increased the size of the PDF file with about 5 MB).
The neweest version of RLReports works with PNG images. That saved me
Also if you have any RLDraw objects on your report, you must set it's brush style to bsClear, so it would allow the background to be visible.

Can I compare screen regions to reference images in UI Automation scripts?

In a UI Automation script, is it possible to save part or all of the screen to a file to compare it to a reference image?
UIATarget has a method captureScreenWithName that takes a screen shot of device screen or captureRectWithName that captures only given rect. Image is saved in log and can be accessed from instruments report.
After taking a screenshot you can use imagemagick command line tools with UIAHost method
performTaskWithPathArgumentsTimeout to compare screenshot with reference one during test or do comparison later after all tests are done...

How to find the source video size using VMR9 renderless mode

My application uses VMR9 Renderless mode to play a WMV file. I build a filter graph with IGraphBuilder::RenderFile and control playback with IMediaControl. Everything plays okay, but I can't figure out how to determine the source video size. Any ideas?
Note: This question was asked before in How can I adjust the video to a specified size in VMR9 renderless mode?. But the solution was to use Windowless mode instead of Renderless mode, which would require rewriting my code.
Firstly you want the Video renderer. You can do this by using EnumFilters on the IGraphBuilder interface. Then call EnumPins on that filter to find the input pin. You can then call ConnectionMediaType to get the media type being fed into that filter. Now depending what formattype is set to you can cast the pbFormat pointer to the relevant structure and from there find out what the video size is. If you want the size before that (to see if some scaling is going on) you can work your way back across the pin using "ConnectedTo" to get the next filter back. You can then find its input pins and repeat the ConnectionMediaType call. Repeat until you get to the filter's pin that you want.
You could use the MediaInfo project at http://mediainfo.sourceforge.net/hr/Download/Windows and through the CS wrapper included in the VCS2010 or VCS2008 folders get all the information about a video you need.
EDIT: Sorry I thought you were on managed. But in either case the MediaInfo can be used, so maybe it helps.

Resources