Click here to Skip to main content
15,914,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My code as follows
C#
Bitmap bitmap = new Bitmap(990, 540);
Graphics graphics = Graphics.FromImage(bitmap as System.Drawing.Image);
graphics.CopyFromScreen(5, 160, 0, 0, bitmap.Size);
bitmap.Save(@"c:\\" + ddlSession.Text.ToString().Trim() + "DailySchedule.bmp", ImageFormat.Bmp);
lblUpdate.Text = "This image is saved";

When i execute the above code in local machine it is working, but when i execute the above code in server error as follows
System.ComponentModel.Win32Exception: The handle is invalid.Error shows in below line as follows
C#
graphics.CopyFromScreen(5, 160, 0, 0, bitmap.Size);
Please help me. What is the problem in my code.

Regards
Narasiman P.
Posted
Updated 21-Oct-13 2:10am
v2

1 solution

 
Share this answer
 

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