|
-
Feb 3rd, 2004, 07:13 PM
#1
Thread Starter
Lively Member
Saving a clipboard image to a file?
Hello,
I ran a few searches on the forum on how to do screenshots. That part is working fine, but how would you save the screenshot to the C:\ ??
So far I have:
VB Code:
Form1.Picture1.Picture = Clipboard.GetData()
SavePicture Clipboard.GetData, "C:\snap\six.jpg"
Any suggestions?
chris
-
Feb 3rd, 2004, 07:46 PM
#2
Hyperactive Member
Re: Saving a clipboard image to a file?
Originally posted by Trancedified
Hello,
VB Code:
Form1.Picture1.Picture = Clipboard.GetData()
SavePicture Clipboard.GetData, "C:\snap\six.jpg"
chris
try:
VB Code:
Form1.Picture1.Picture = Clipboard.GetData(vbCFBitmap)
Dim myPic As New StdPicture
Set myPic = Clipboard.GetData(vbCFBitmap)
SavePicture myPic, "C:\snap\six.jpg"
-
Feb 4th, 2004, 12:29 PM
#3
Thread Starter
Lively Member
error
Temp,
Thanks for your reply but i get an error here:
VB Code:
SavePicture myPic, "C:\snap\six.jpg"
-
Feb 4th, 2004, 12:36 PM
#4
Hyperactive Member
Re: error
Originally posted by Trancedified
Temp,
Thanks for your reply but i get an error here:
VB Code:
SavePicture myPic, "C:\snap\six.jpg"
You need save it as BMP:
SavePicture myPic, "C:\snap\six.bmp"
to save it as JPG, you need do some extra work.
-
Feb 4th, 2004, 04:34 PM
#5
Thread Starter
Lively Member
Same error
Temp,
I tried it again w/ a bmp extension, but the same error comes up as the previous post. Here's my screenshot code and the sub that saves the .bmp is on the bottom.
VB Code:
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Private Declare Sub Sleep Lib "kernel32" (ByVal sleepTime As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_SNAPSHOT = &H2C
Private Const VK_MENU = &H12
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetVersionExA Lib "kernel32" (lpVersionInformation As OSVERSIONINFO) As Integer
Dim blnAboveVer4 As Boolean
Private Function SnapShot()
If blnAboveVer4 Then
keybd_event VK_SNAPSHOT, 1, 0, 0
Else
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
End If
End Function
Private Sub cmdSave_Click()
Form1.Picture1.Picture = Clipboard.GetData(vbCFBitmap)
Dim myPic As New StdPicture
Set myPic = Clipboard.GetData(vbCFBitmap)
[B]SavePicture myPic, "C:\snap\six.bmp"[/B]
End Sub
Any other ideas?
Thanks,
Chris
-
Feb 4th, 2004, 08:27 PM
#6
The picture isn't missing
if that is your whole program, then you forgot to call
SnapShot
you are also going to need a little pause between screenshot taking and file saving or else you would get an error sometimes.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Feb 5th, 2004, 03:49 AM
#7
If you want to save it as a JPG, look here...
http://www.vbforums.com/showthread.p...hreadid=274353
BTW our Good Old Platipus just uploaded his new PNG controll. Look for the thread in the game section. So if you want PNG picture you can probably use his controll. Havn't tested it yet tho'
ØØ
-
Feb 5th, 2004, 04:35 PM
#8
Thread Starter
Lively Member
Buggy,
Here's the remainder of the my code and I added the call to SnapShot. I still get the same error on the text that's bold.
"invalid property value"
VB Code:
Private Sub cmdSixShow_Click()
Call Disable
Me.Timer1.Enabled = True
Picture13.Picture = Clipboard.GetData(vbCFBitmap)
Dim myPic As New StdPicture
Set myPic = Clipboard.GetData(vbCFBitmap)
[B]SavePicture myPic, "C:\snap\six.bmp"[/B]
End Sub
Public Sub Timer1_Timer()
timer1.interval = 100
Timer1.Enabled = False
cboSelection.Visible = False
Call SnapShot
Call Enable
End Sub
Any other suggestions?
-
Feb 8th, 2004, 01:17 PM
#9
The picture isn't missing
try
SavePicture picture13.picture, "C:\snap\six.bmp"
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Feb 9th, 2004, 06:01 PM
#10
Thread Starter
Lively Member
Yeah same error "Invalid Property Value"
Any other ideas? keep 'em coming!
Chris
-
Feb 10th, 2004, 01:35 AM
#11
Do you have a picturebox called Picture13 on your form. Becuase that cod eshould work. And you also have to have the path C:\snap\, might also consider turning the autoredraw property to true..
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
|