|
-
Jan 4th, 2001, 11:57 PM
#1
Is there a way I can take a screenshot of the screen and save it to a file. If there is any way to set the quality and color (color & B&W) properties please tell me how to set those too.
-
Jan 5th, 2001, 12:32 AM
#2
PowerPoster
Try this.
Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_SNAPSHOT = &H2C
Private Const VK_MENU = &H12
Private Sub Command1_Click()
'Capture the Entire Screen
keybd_event VK_SNAPSHOT, 1, 0, 0
'Save the capture image
SavePicture
End Sub
Private Sub Command2_Click()
'Capture the Active Window
keybd_event VK_MENU, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
'Save the capture image
SavePicture
End Sub
Private Sub SavePicture()
'Delay 3 seconds
Sleep 3000
'Load Image into the PictureBox
Picture1.Picture = Clipboard.GetData()
'Delay 3 second to complete load the image into the PictureBox Control
Sleep 3000
'Save new image file
SavePicture Picture1, App.Path & "\MyPics.bmp"
End Sub
-
Jan 10th, 2001, 02:00 PM
#3
SavePicture Picture1, App.Path & "\MyPics.bmp"
"Wrong number of arguments or invalid property assignment"
-
Jan 10th, 2001, 08:52 PM
#4
PowerPoster
Hi! conquerdude, Sorry abt the sample code. The SavePicture
function should be use others name. "coz it crash with the
VB global object "SavePicture" and that the reason why you
encounter error.
Here the correct one.
Code:
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_SNAPSHOT = &H2C
Private Const VK_MENU = &H12
Private Sub Command1_Click()
'Capture the Entire Screen
keybd_event VK_SNAPSHOT, 1, 0, 0
'Save the capture image
Save2File
End Sub
Private Sub Command2_Click()
'Capture the Active Window
keybd_event VK_MENU, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
'Save the capture image
Save2File
End Sub
Private Sub Save2File()
'Delay 3 seconds
Sleep 3000
'Load Image into the PictureBox
Picture1.Picture = Clipboard.GetData()
'Delay 3 second to complete load the image into the PictureBox Control
Sleep 3000
'Save new image file
SavePicture Picture1, App.Path & "\MyPics.bmp"
End Sub
Cheers!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|