GraphicsEx.CopyFromScreen exceptions

Last post 02-19-2008 14:34 by jokerboy. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 02-19-2008 14:07

    GraphicsEx.CopyFromScreen exceptions

    I'm getting an exception when using this method when the explorer shell is not running.  The exception is a Win32Exception.

    The Stacktrace is:

    at OpenNETCF.Drawing.GraphicsEx.CopyFromScreen()
    at OpenNETCF.Drawing.GraphicsEx.CopyFromScreen()
    at MyNamespace.FormBase.Snapshot()
    at MyNamespace.Button.OnPaintBackground()
    at System.Windows.Forms.Control.WnProc()
    at System.Windows.Forms.Control._InternalWnProc()
    at Microsoft.AGL.Forms.WL.BeginPaint()

     The call works great as long as the shell is running.  Any suggestions?  Is this expected?

    Thanks,

     note: this is the SDF Version 2.2

     

    Filed under:
  • 02-19-2008 14:26 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 1,939

    Re: GraphicsEx.CopyFromScreen exceptions

    If you look at the source for CopyFromScreen, the first call it makes is GetDesktopWindow() followed by a GetWindowDC for that HWND - my bet is that this API is serviced by a call to the shell application to get the shell container, and if you have no shell, there is no window to get.

     

    Filed under:
  • 02-19-2008 14:34 In reply to

    Re: GraphicsEx.CopyFromScreen exceptions

    Makes sense.

    I don't have the source for 2.2 yet, so I'll wait till then to find a work around.

    Thanks for the response.

Page 1 of 1 (3 items)