Taking a screenshot with lua in the windows operating system - winapi

I am trying to take a screenshot of the whole screen on windows using a lua script but I can't seem to find any resource online about it.
Is this even possible?

Related

Why would PDF Text extraction hang for a single PDF but work via RDP

I have a program that extracts text from PDFs. It runs as a scheduled task on Windows Server 2008.
The library I use is ByteScout's PDF Extractor SDK, which is based on Tesseract under the covers.
Since it went live last November, the program has successfully extracted text from over 50,000 PDFs from many different sources.
It recently hung on a single PDF and subsequently on a second one, from the same source in the same visual format.
I am able to recreate the problem using a trivial 12 line program. I sent this program to the vendor but running that program in their environment works (it does not hang).
So I did some experimentation and this is where it gets strange.
The program works on my PC (Windows 7) if I RDP to it, but not if I am directly logged in. This behavior is repeated on other Windows 7 PCs in our environment.
It works on Server 2008 if I am RDPed, but not as a scheduled task.
It works on Windows 10, whether I am RDPed or logged in directly.
If I watch the program in Process Monitor when it is stuck, I can see that it is opening and reading C:\Windows\Fonts\times.ttf over and over again.
If it was only working using RDP, I'd wonder if the cause had anything to do with failing use of graphics acceleration or some such, but given that it doesn't work as a scheduled task where none would be present either, I think that's a blind alley.
Does anyone have any suggestions where to look next?
So ByteScout have fixed the problem. To quote Eugene on the cause ...
The problem is in System.Drawing and GDI+. Sometimes it crashes on text drawing operations that are normal in PDF but causing some internal exceptions in System.Drawing. Moreover, it's behavior varies depending on display device capabilities. That is why it works in RDP session and crashes on a desktop.
We are trying various workarounds on these crashes, attempting to fall back to alternate text drawing ways. The hanging is related to these fallbacks.

How to detect Windows XP using Ruby?

Working on a game atm using Ruby, but due to the nature of how the game is coded Windows XP is proving to be a issue, as various tweaks can be done to make you faster than other players
so my intentions are to upon loading of the game detect if you are running windows XP, and if so fail to load any further.
This may seem harsh, but the advantages XP gives over Vista or Win7 etc is vast and is unbalanced.
Can any one help?
Here you find some solutions on how to detect the operating system:
How can I find which operating system my Ruby program is running on?
But I think, it only tells you, if it is Windows or not. So you have to do a second step:
If it is Windows, you could call the system command ver to detect the Windows Version (As you might know, system commands can be called using the `-Symbol).
`ver`
More information about this command are found here: http://www.windows-commandline.com/2009/01/find-windows-os-version-from-command.html

Ollydbg is not displaying api calls in comments. It will not analyze the program either

I am using Ollydbg 2.01 on Windows 7 x64. Any time I open a program, Olly does not display the API calls. Here is what I would like to see, notice the API calls in the comments section:
And here is what I see
Note the lack of API calls and just general info. Trying to analyze (Ctrl+A) doesn't do anything either. One thing I have noticed is that attempting to set the .UDD path file does not work. I set the API Help file (which works fine) and the .UDD path file, restart Olly, and when I look at the .UDD path, it has been replaced by a single period.
The issue was I was simply not using the latest version of Olly. Downloading it solved the issue I was having.

FMJ not working on initial download

I've written some application code using JMF, but would like to switch to FMJ to make delivery easier.
Unfortunately, on my Windows 7 laptop (where JMF works fine once installed), I downloaded fmj-20070928-0938.zip, uncompressed it, and ran fmjstudio.bat. As soon as I click on the webcam icon, I get errors which start with "WARNING: com.lti.civil.CaptureException: java.lang.UnsatisfiedLinkError: C:\Temp\fmj-extracted\native\win32-x86\civil.dll: Can't find dependent libraries"
Any suggestions?
Although it is probably not a complete answer, a partial answer is that FMJ uses 32-bit libraries. I am fairly sure I was using a 64-bit java.
On a different Windows 7 computer I successfully got fmjstudio to run using a 32-bit java. Next step is getting it to recognize the camera for my own app rather than fmjstudio.

Present a default window layout on startup in Windows 7

I have a Win7 PC in use as part of an experiment control system. The experiment in question uses 4 windows simultaneously, and I would like to find away to open, position and size these 4 windows with a script.
The script would run at start up, so that the newly booted PC presents the user with the four windows as default.
Obviously I can use a batch file in the startup folder to open windows and run applications, but is there a way to specify the layout of these windows?
Many thanks
Si
Assuming that you have access to a scripting language that supports making calls to Windows API functions it shouldn't be too hard. Otherwise I'd suggest writing a small executable in some language (at least any of C++, C# or VB.Net would all work fine) and have that do it.
You could use FindWindow, as described here, to find the windows and MoveWindow, as described here, to move them around.
I use an AutoHotkey script to set up all my environment (around 7 windows in 3 different virtual screens), works pretty well. You can set the location of windows etc.
I can use a batch file to open the apps, then run WiLMA to relocate them

Resources