API for getting screen region changes? - windows

I am writing a sort of screen-recording app for Windows and wish to know when and which regions of the screen/active window have changed.
Is there a Windows API I can hook to get notified of screen changes?
Or would I need to manually write something like this? :(
I always figured that Remote Desktop used some sort of API to detect what regions of the screen had changed and only sent back those images - this is exactly the behavior that I need.

I don't think there is an API in Windows that can tell you which parts of the screen have changed.
One possible way is using a video mirror driver like UltraVNC uses.

I think you'll find some clues here Screen Event Recorder DLL/Application, here About Hooks, and here Writing a Macro Recorder/Player using Win32 Journal Hooks

It would seem that you're going to have to do a fair bit of work to detect screen changes. This posting at tech-archive.net for instance. With this you can copy to RAM a reference screen and then take another and compare the two. It'd be up to you to define what kind of a change is a meaningful one. It's similar material to this article on desktop capture.

I think Remote Desktop streams GDI like commands. I don't know how they capture them in the first place.

Thanks for your help everyone. I ended up writing an image differencing class which seems to calculate the changed rectangles suprisingly quick. I've posted the gist of how it works here.
At the moment I'm just doing it in a timer but planning to do it after input events too.
Thanks heaps for your links Boost - I've only just looked at this thread again so I'll check them out soon.

Related

Live, evolving, dynamic wallpaper (desktop) on a Mac

Should it be possible to develop a dynamic desktop for the Mac? By "dynamic," I mean a desktop whose images take system parameters, such as the time and job information, and use this information to update the image. Information about image states would also be preserved between sessions. I'm not talking about a movie or a stochastic but autonomous screen saver. Is there any reason a user couldn't develop such a thing? (I'd like to ask how but am trying to keep the question constrained.)
I'm not new to programming but have no sense how Macs work. I'd like to know if there's some fatal flaw in my goal before I start digging in. Thanks in advance for any pointers.
Update: Wikipedia implies there's no direct way to do what I want to do--Mac desktop wallpaper must come from a folder of static images or a screen saver. The only viable approach I see at the moment would be to generate images periodically for such a screen saver (e.g., by adapting this Python script). If this is stupid or a slicker method might exist, would love to hear it.
Very late response but I only stumbled across the question and noticed some recent interest...
Aren't you looking for something like GeekTool ?
This seems to have been implemented in the latest version of Mac OS X: Mojave.
This article has some tips on how to make your own, towards the bottom: https://www.howtogeek.com/369645/download-more-dynamic-wallpapers-for-mojave-or-make-your-own/

How can I warp/resize/translate the windows desktop output?

I saw this video (YouTube) and I want to make use of the ability shown at 3:00. Can anyone tell me what is being used here? Ideally suggestions would work on Windows 7 at least.
I've had a few google searches for "Active Windows Desktop", which was mentioned in the video, in an attempt to finding something that has this feature but I failed at finding anything
I'd recommend you look into WPF -- it has built-in features for arbitrary transformations of window content, so it would probably be a good place to start looking.

How to read some data from a Windows application memory?

I have an application, which displays me some data. I need to attach to this app's process, find the data I need in memory (one single number, actually), and save it somewhere. This application doesn't seem to use standard windows controls, so things aren't going to be as simple as reading controls data using AutoIt or something similar.
Currently I'm a self-learner database guy and have quite shallow knowledge about windows apps debugging. Not even sure if I asked my question correctly enough.
So, can you give me some starter guidelines about, say, what should I read first, and general directions I should work on?
Thanks.
To read memory of other application you need to open the process with respect of OpenProcess with at least PROCESS_VM_READ access rights and then use ReadProcessMemory to read any memory address from the process. If you are an administrator or have debug privilege you will be able to open any process with maximal access rights, you need only to enable SeDebugPrivilege before (see for example http://support.microsoft.com/kb/131065).
If you don't know a much about the memory of the destination process you can just enumerate the memory blocks with respect of VirtualQueryEx (see How does one use VirtualAllocEx do make room for a code cave? as an example where I examine the program code. The program data you can examine in the same way).
The most practical problem which I see is that you ask your question in too general way. If you explain more what kind of the data you are looking for I could probably suggest you a better way. For example if you could see the data somewhere you could examine the corresponding windows and controls with respect of Spy++ (a part of Visual Studio Tools). The most important are the class of windows (or controls) and the messages which will be send at the moment when the most interesting window are displayed. You can also use Process Monitor to trace all file and registry access at the time when the windows with the interesting information will be displayed. At least at the beginning you should examine the memory of the process with ReadProcessMemory at the moment when the data which you are looking for are displayed on the window.
If you will have no success in your investigations I'd recommend you to insert in your question more information.
My primary advice is: try to find any other method of integration than this. Even if you succeed, you'll be hostage to any kinds of changes in the target process, and possibly in the Windows O/S. What you are describing is behaviour most virus scanners should flag and hinder: if not now, then in the future.
That said, you can take a look at DLL injection. However, it sounds as if you're going to have to debug the heck out of the target process at the disassembly level: otherwise, how are you going to know what memory address to read?
I used to know the windows debugging API but it's long lost memory. How about using ollydbg:
http://www.ollydbg.de/
And controlling that with both ollydbg script and autoit?
Sounds interesting... but very difficult. Since you say this is a 'one-off', what about something like this instead?
Take a screenshot of this application.
Run the screenshot through an OCR program
If you are able to read the text you are looking for in a predictable way, you're halfway there!
So now if you can read a OCR'd screenshot of your application, it is a simple matter of writing a program that does the following:
Scripts the steps to get the data on the screen
Creates a screenshot of the data in question
Runs it through an OCR program like Microsoft Office Document Imaging
Extracts the relevant text and does 'whatever' with it.
I have done something like this before with pretty good results, but I would say it is a fragile solution. If the application changes, it stops working. If the OCR can't read the text, it stops working. If the OCR reads the wrong text, it might do worse things than stop working...
As the other posters have said, reaching into memory and pulling out data is a pretty advanced topic... kudos to you if you can figure out a way to do that!
I know this may not be a popular answer, due to the nature of what this software is used for, but programs like CheatEngine and ArtMoney allow you to search through all the memory reserved by a process for a given value, then refine the results till you find the address of the value you're looking for.
I learned this initially while trying to learn how to better protect my games after coming across a trainer for one of them, but have found the technique occasionally useful when debugging.
Here is an example of the technique described above in use: https://www.youtube.com/watch?v=Nv04gYx2jMw&t=265

Programmatically enable multitouch support?

I am running windows7 on my laptop, and all is well, but I am jealous of the multitouch on macs. I don't really know how all of this "works", but i'm imagining that it couldn't be that hard to write a program to patch into windows that allows this.
Currently, if I put two fingers on the pad and drag around, it sortv half-heartedly tries to follow both. Or something. It's pitiful. After extended experimentation, I don't think it can really track both points at once. But perhaps I could detect the fumbling that occurs when I put my second finger down mathematically, and then "release" tracking on one of them.
Basically, I'm not trying for true multitouch (like stretching images), but I feel like I ought to be able to get something together that detects a double press as a right click. That's a step in the right direction.
What would I need to write that in? How would I install it?
If you're going to say it's impossible, then ignore that and take it from another direction. What if I wanted to enable a triple tap as a right click? (please no pre-built 3rd party solutions, I want to write this myself) That's certainly got to be possible.
How do I tap in to the resources I need?
This might be a hardware and or driver limitation. Not all touch surfaces (like trackpads) support multitouch.
You might want to check out Raw Input on msdn which supports alternative input methods.
Edit:
Note that the Raw Input API only provides access to multitouch if its supported by your hardware.
This is not possible, this is discussed on the www.insanelymac.com forum, where people create hackintosh pcs (basically pcs running mac osx). Several attempts have been made, but DUE to the construction and METHOD with which MANY touchpads collect sensory data it is impossible. Best of luck...

A Good, Free screen sharing program for pair programming?

I am looking for a good, free (preferred) screen sharing program that works well for pair programming and code review sessions for Windows (Vista x64, Server 2008). It should allow either person take control of the screen and be fairly responsive for text editing over decent broadband connections. Additional features like the ability to draw/mark/annotate the other persons screen would be nice.
Edit: This will be used by developers in remote locations.
TeamViewer from http://www.teamviewer.com/ works very well. We use it for pair programming between London and Ukraine.
Notes:
We use Skype for voice.
TeamViewer uses extremely low bandwidth - 4kbyte/sec on average for programming in Visual Studio 2008 # 1024x768 resolution.
Can swap roles from hotseat to viewer with a button.
The remote view of the screen can be resized to fit in a smaller area with no loss in usability.
Windows Shared View works for me. It allows you to only share certain windows and even shows where your "attendees" mouse is. It would be best to use that in connection with some sort of voip connection so that you don't have to type questions/responses back and forth.
I have checked some hours now for a good one.
Best and the simplest thing i have found.
http://www.screenleap.com/
Free, no strings found so far.
No need to waste time installing or registering anything.
Works perfect with "share are only" if you have multimontor setup.
Most other software shares full screen default, and you cannot choose which monitor you share.
You need to be aware that it does not encrypt data. Check FAQ.
But if you have to run voice over Skype/Mymble/Whatever separate anyway..
What harm can a hacker do by simply getting 50% of the conference ?
Pff.. Oh you wished for screen sharing.. this one does not have it.
So try: http://www.mingleview.com/
It has that multimonitor "bug" and you need to install a simple pluginlike thing.
But "take control" is there and it's very simple also.
Most other software has bundled unneccesary functions like calendaring, document system, filesharing which i already have solutions for.
It's like developing games on excel macros..
unneccesary.. developers please learn that already !
I haven't actually tried it yet, but it looks promising. Check out DimDim. They have a free web service and a VMWare image on Sourceforge.
If you're using eclipse, you might wanna try ECF. There's a video presentation available here.
Try Mikogo at www.mikogo.com
very easy to setup. no problems with Firewalls etc etc
And my final suggestion, but this is not one I've tried. Go to Crossloop
On OSX, I've used vim and a multi-user GNU screen session - this gives much better responsiveness than VNC, screen-sharing, etc. I guess you could use these with Cygwin?
I like to use Screen Hero, which allows both users to use the mouse on the shared screen: http://screenhero.com/
or Zoom: http://zoom.us/
For a poor-man's solution, you can use the free edition of RealVNC. On the server, un-check all of these boxes:
(source: realvnc.com)
Would a VNC client not do the trick, combined with a one of those screen overlay apps people use for presentations (screenpen rings a bell)?
Another option is to use VNC, but use reverse connections. Have a look at this I use this in conjunction with No-IP to get a fixed address.
Do you need this to be remote?
You could just have two monitors set to mirror and 2 USB keyboards/mice
If it is remote then VNC is the way to go, I would use UltraVNC if you are looking for a free version, it has more features (chat, file transfer) than the free version of VNC - it also has a video driver hook that means it suffers less from any weird screen issues than regualr VNC.
If firewalls are a problem you can simply set up a VPN (which is probably a good idea anyway - although ultra can do encryption).
How about any of the services like Joel's https://www.copilot.com/?
Have you looked at the collaboration module that comes with netbeans? Its very useful for pair programming!
For multi-platform simplicity, I would suggest
https://join.me/ for screen share (you can even view a remote
screen using iOS!)
getting a phone headset, and using the phone for audio.

Resources