dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: VB7
Expertise: Intermediate
Dec 1, 2003

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


GetScreenSnapshot - Retrieving the current contents of the screen or the active window

' Return the current contents of the screen or the active window
' It works by simulating the typing of the Print-Screen key (and Alt key if 
' activeWindowOnly is True), which dumps the screen to the clipboard.
' 
' Example: PictureBox1.Image = GetScreenSnapshot(True)

Function GetScreenSnapshot() As Image
    Return GetScreenSnapshot(False)
End Function

Function GetScreenSnapshot(ByVal activeWindowOnly As Boolean) As Image
    ' Alt-Print Screen captures the active window only
    If activeWindowOnly Then
        SendKeys.SendWait("%{PRTSC}")
    Else
        SendKeys.SendWait("{PRTSC 2}")
    End If

    ' return the bitmap now in the clipboard
    Return DirectCast(Clipboard.GetDataObject().GetData(DataFormats.Bitmap), _
        Image)
End Function
Marco Bellinaso
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date