Friday, April 16, 2010

Save the screen and extract data

I wrote a quick snippet to save the screen appears with a click in my documents with a unique name given by a constant prefix and a unique item, and ordered that the time variable current date expressed in ticks:

this code

/ / Begin snippet

Bitmap bitmap;
int w, h;
w = System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Width;
h = System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Height;
Rectangle screenRegiion Screen.AllScreens = [0]. Bounds;
bitmap = new Bitmap (w, h, PixelFormat.Format32bppArgb);
SGraph Graphics = Graphics.FromImage (bitmap);
sGraph.CopyFromScreen (screenRegiion.Left, screenRegiion.Top, 0, 0, screenRegiion.Size);
string str = DateTime.Now.Day + "_" + DateTime.Now.Month + "_" + + DateTime.Now.Year "_uniqueid =";
string = savedPath Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments) + "\ \ saved_from_screen_" + str + + DateTime.Now.Ticks. "bmp";
bitmap.Save (savedPath);

/ / End snippet

the code is not tested and licensed "as is"

the result, if desired, can be analyzed with MoreDataFast
download

No comments: