none
print screen capture C# console aplication RRS feed

  • Question

  • Hello
    Looking for help to take over the desktop. I wanted to write the applicate which will react to what is happening on the desktop. I led the mouse. I mean download to your desktop application variable.
    Sunday, March 5, 2017 3:29 PM

All replies

  • Sunday, March 5, 2017 4:01 PM
  • Just one important rule is that you can not use this from a Windows Service or have the programm started from a Service (without special Parameters or Manifest).

    Access to the Desktop requires a interactive session. Services are barred from those since Vista and the UAC came along: Interactive Services (Windows)

    If you need it automatically started, consider the Task Sheduler rather then a Service.

    Also note that there are dozens of Desktop/Test Automation Solutions already out there. You might be better of just using one of those.


    Remember to mark helpfull answers as helpfull and close threads by marking answers.

    Sunday, March 5, 2017 11:11 PM
  • If you are looking for an easy library to use for screen capturing, I suggest checking out LEADTOOLS. There is some sample code you can check out at https://www.leadtools.com/help/leadtools/v19m/dh/sc/screencaptureengine.html

    or check out the online demo here:

    https://www.leadtools.com/demos/click-once/ocr-screen-capture

    Tuesday, March 7, 2017 2:47 PM
  • Hi krystian904,

    I've made a small sample about capture your screen

    using System.Drawing.Imaging;
    
    static class Module1
    {
    
    	public static void main()
    	{
    		using (Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height)) {
    			using (Graphics g = Graphics.FromImage(bitmap)) {
    				g.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
    			}
    			bitmap.Save("C:\\temp\\ScreenCapture.jpg", ImageFormat.Jpeg);
    		}
    		System.Environment.Exit(0);
    	}
    }

    Hope it helps!

    Best regards,

    Kristin


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 8, 2017 3:06 AM
    Moderator