Click here to Skip to main content
15,939,960 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,

I am developing project on Activity Screen and system monitoring in This is standalone application. In this application, every 10 seconds i want to capture the screenshots of the window. and store those screenshots in locked folder.

This is my Screen Capturing code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.Threading;
using System.Security.Principal;

namespace SystemMonitoring
    public partial class Form1 : Form
        int pictureCount = 0;
        private static Bitmap bmpScreenShot;
        private static Graphics gfxScreenShot;
        public Form1()
        private void Form1_Load(object sender, EventArgs e)
            for (pictureCount = 0; pictureCount - 1 < pictureCount; )
                bmpScreenShot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                gfxScreenShot = Graphics.FromImage(bmpScreenShot);
                gfxScreenShot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);

                 bmpScreenShot.Save(@"D:\brinda\" + System.Environment.GetEnvironmentVariable("COMPUTERNAME") + DateTime.Now.ToString("_dd-MM-yyyy_HH_mm_ss") + ".jpeg", ImageFormat.Jpeg);                

Now i want to store the screenshots in locked folder. but the problem is when folder is locked then i am not able to store the screenshots in that folder.Please help me out.
Updated 29-Jan-15 19:42pm
BillWoodruff 30-Jan-15 1:42am    
If you lock the folder, can't you unlock it, write to it, then re-lock it ?
Brinda Lakhani 30-Jan-15 1:48am    
No, Only admin can perform any operation on that folder.
Brinda Lakhani 30-Jan-15 2:41am    
if you have any idea then please post here.

1 solution

Refer - Lock And Unlock A Folder ([^].

When you want to save one new file inside the folder, just unlock it and then save the file. After saving, again lock the folder. That's it.
Share this answer
Brinda Lakhani 5-Feb-15 0:00am    
dear, i want to store the screenshots automatically in locked folder. I am making application of system monitoring, not a folder locker.
Answer is simple you cannot. You cannot put something inside the locked folder. While you save the screenshot, just unlock it and save the file. Then lock it again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900