0

I am writing a program that acts as a live remote desktop, and this works really well. The pc that sends information about it's screen checks if a part or the entire screen has changed and sends this new (partial) information to the view client. this is a continues process and eats away some processor time (depending on the machine about 3-15%) and i would like to bring this down, is there a way to detect that the screen data has changed? just an 'event' like if somthing has changed (one pixel to all of the pixels) so i can act on this and check what the changes are instead of doing this in a loop.

Jeffnl
  • 261
  • 1
  • 4
  • 21
  • You need to cache and then compare two bitmaps using unsafe function pointers (for performance reasons). I do not know of any articles off hand, sorry. – User 12345678 Aug 21 '14 at 09:35
  • @ByteBlast Why is your answer a comment? – Martin Horatschek Aug 21 '14 at 09:42
  • @ByteBlast That is the method that i am using to detect if and what changed. but this takes some cumputing time, so i was hoping for a method deeper in windows that can tell me if the data from the screen has changed. i now detect howmany frames per second i get and so try to lower framerate when nothing happens in the screen, this works but i hoped for another method. – Jeffnl Aug 21 '14 at 10:18
  • You should revise the algorithm to make it more efficient. I know it is possible because I have done it D: The Windows API does not expose any such method by the way. – User 12345678 Aug 21 '14 at 10:21
  • To make things fast you need to use Lockbits. [Here](http://stackoverflow.com/questions/24411114/c-sharp-copy-bitmaps-pixels-in-the-alpha-channel-on-another-bitmap/24411925#24411925) an answer which does something similar in that it goes through two Bitmaps; you can easily modify it to find changes between two Bitmaps..[Here](http://stackoverflow.com/questions/24411114/c-sharp-copy-bitmaps-pixels-in-the-alpha-channel-on-another-bitmap/24411925#24411925) is an example that does just that by writing the differences into a 3rd Image. – TaW Aug 21 '14 at 11:42
  • I think you want to go the other way... Detect when a change occurs and only transmit the changed rectangle. Doesn't matter if the receiving FPS is 0.1 if nothing has changed. You could also check every other pixel which would quarter your workload and still be likely to pick up most changes (at least most significant ones), especially if you add 1px around each rectangle you transmit – Basic Oct 24 '14 at 18:03
  • I think that this link will completely fix your problem: https://learn.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getupdaterect – Javlonbek Jul 14 '18 at 14:29

0 Answers0