Print Screen

VB.NET:
SendKeys.SendWait("%{PRTSC}")
Dim Image As Bitmap = DirectCast(System.Windows.Forms.Clipboard.GetDataObject.GetData(System.Windows.Forms.DataFormats.Bitmap), Bitmap)
 
JuggaloBrotha, when i try ur code i take the following message

LoaderLock was detected
Message: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang.

But thnx i now can take photos using my program.
thnx all for your help!
 
where in your application did you put my code? i've never had trouble with it on the 1.1 framework
 
JuggaloBrotha, Thats my code
VB.NET:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        SendKeys.SendWait("%{PRTSC}")
        Dim Image As Bitmap = DirectCast(System.Windows.Forms.Clipboard.GetDataObject.GetData(System.Windows.Forms.DataFormats.Bitmap), Bitmap)
    End Sub
Have i made something wrong???
 
that's how i use it too, although you're using vb 2005 whereas i'm using vb 2003, 2005 may handle that code differently which is why you're getting an error and i dont
 
Intersting exception that one. Here's the exception explained....

Originally Quoted By MSDN
the OS loader lock prevents multiple threads or processes from attempting to load DLLs at the same time, which could corrupt global data structures used during the loading process.

Not sure how much that helps. Though i do remember hearing that it is possible to turn off that warning.
 
I don't get any error with that code in VB2005.
 
Back
Top