|
|
Title | Let the user grab part of the screen |
Description | This example shows how to let the user grab part of the screen in Visual Basic 6. |
Keywords | grab screen, capture screen |
Categories | Graphics |
|
|
Thanks to Sergio Perciballi.
When the user selects the Capture menu's Grab Screen command, the program hides itself and starts a Timer. The Timer waits a while and then grabs the desktop image. See the code for details about how the GetScreenSnapshot subroutine works.
The Timer then displays the image on Form1, which is maximized to cover the desktop.
|
|
Private Sub mnuGrabScreen_Click()
MDIForm1.Visible = False
Form1.Visible = False
'start main grab sequence
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Static count
'wait a bit then get screen;
'count 0-4 ;timer on 500 interval
If count > 3 Then
Form1.Picture = GetScreenSnapshot(0)
count = 0
Timer1.Enabled = False
Form1.Visible = True
End If
count = count + 1
End Sub
|
|
Form1's MouseDown, MouseMove, and MouseUp events let the user select part of the desktop image. The program creates a new MDI child form and displays that part of the image in it.
|
|
|
|
|
|