c# - Get screenshot with mouse cursor and send for client application -


i took this function getting screenshot client application. tried adapt function in project, can not capture desktop showing mouse cursor (coming remote pc) in server application (controller).

here adaptation (in client side) without success:

void sendscreenproc()         {             // send first bitmap             memorystream streamscreen = new memorystream();             this.bmpscreensend = capturescreen(true);//new bitmap(this.boundscreen.width, this.boundscreen.height, pixelformat.format24bpprgb);             graphics g = graphics.fromimage(this.bmpscreensend);             g.copyfromscreen(0, 0, 0, 0, this.boundscreen.size);             this.bmpscreensend.save(streamscreen, system.drawing.imaging.imageformat.png);             compress.compressstream(streamscreen);             byte[] bufferscreen = streamscreen.toarray();             mresenddata.waitone();             this.queuesenddata.addscreen(streamscreen.getbuffer());             streamscreen.close();             this.receivedscreen = 0;              while (this.remoted)             {                 // send next bitmap result difference previous bitmap.                 if(this.receivedscreen == 0) {                  } else {                     bitmap bmpcurrentscreen = capturescreen(true);//new bitmap(this.boundscreen.width, this.boundscreen.height, pixelformat.format24bpprgb);                     g = graphics.fromimage(bmpcurrentscreen);                     g.copyfromscreen(0, 0, 0, 0, this.boundscreen.size);                     if (this.receivedscreen == 1) {                         if(this.bmpscreen != null) {                             this.bmpscreen.dispose();                         }                         this.bmpscreen = this.bmpscreensend;                     } else if(this.receivedscreen == 2) {                      }                     if (queuesenddata.availablescreenadd && isdifferent(bmpcurrentscreen, this.bmpscreen))                     {                         streamscreen = new memorystream();                         bitmap bmpdiff = xorbitmap(this.bmpscreen, bmpcurrentscreen);                         bmpdiff.save(streamscreen, system.drawing.imaging.imageformat.png);                         this.bmpscreensend.dispose();                         bmpdiff.dispose();                         this.bmpscreensend = bmpcurrentscreen;                         mresenddata.waitone();                         this.queuesenddata.addscreen(streamscreen.getbuffer());                         streamscreen.close();                         this.receivedscreen = 0;                     }                     else                     {                         bmpcurrentscreen.dispose();                     }                 }                 thread.sleep(30);             }         }  


Popular posts from this blog