You can use this C# code to save lots of the screenshot once there'll be any risk of error within the application .If the consumer is victimization the appliance developer will raise the consumer to send the screenshot in order that he will grasp within which page the error was occured
C
For Taking
picture:
Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height);
Graphics
graphics = Graphics.FromImage(bitmap as Image);
graphics.CopyFromScreen(0, 0, 0, 0,
bitmap.Size);
bitmap.Save("c:\\photo.jpeg",
ImageFormat.Jpeg);.
For Send Mail:
public void SendAttachedEmail(string
to, string subject, string
path)
{
//To
connect the SMTP server for mailing.
try
{
MailMessage objMailMsg = new MailMessage(EmailSender, to);
objMailMsg.Subject = subject;
Attachment objAttachment = new Attachment(path);
objMailMsg.Attachments.Add(objAttachment);
System.Net.Mail.SmtpClient objSmtpClient = new
SmtpClient("192.168.10.1", 25);
objSmtpClient.Send(objMailMsg);
}
catch
(Exception ex)
{
throw
ex;
}
}
C







0 comments:
Post a Comment