Click here to Skip to main content
16,014,392 members

Comments by Member 8311095 (Top 3 by date)

Member 8311095 2-Mar-12 5:51am View    
Server Error in '/OnlineAutomation' Application.
The handle is invalid
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ComponentModel.Win32Exception: The handle is invalid

Source Error:

Line 54: System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap as System.Drawing.Image);
Line 55:
Line 56: graphics.CopyFromScreen(25, 25, 25, 25, bitmap.Size);
Line 57:
Line 58: bitmap.Save(@"c:\myscreenshot.bmp", System.Drawing.Imaging.ImageFormat.Bmp);


Source File: c:\Inetpub\wwwroot\OnlineAutomation\Forms\test.aspx.cs Line: 56

Stack Trace:

[Win32Exception (0x80004005): The handle is invalid]
System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation) +542
System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize) +29
Forms_test.btnsave_Click(Object sender, EventArgs e) in c:\Inetpub\wwwroot\OnlineAutomation\Forms\test.aspx.cs:56
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053


i need not capture coding page. capture in running webpage that is display page

my code as follows

System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);

System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap as System.Drawing.Image);

graphics.CopyFromScreen(25, 25, 25, 25, bitmap.Size);

bitmap.Save(@"c:\myscreenshot.bmp", System.Drawing.Imaging.ImageFormat.Bmp);

help me
Member 8311095 2-Mar-12 5:01am View    
windows.form using CopyFromScreen did not work.its display error handle invalid so i think clientside possible.but how do? help me
Member 8311095 2-Mar-12 5:00am View    
yes,in windows.form using CopyFromScreen did not work.its display error handle invalid so i think clientside possible.but how do? help me