[RESOLVED] Screenshot-Help me
I want to get the whole screen in image control and then save it to my folder.
Every thing is working fine except the image saved in the folder. Is there any problem in the following code? I also want that the image saved should be overwritten.
vb Code:
Private Sub Command1_Click()
Timer1.Enabled = True
Me.WindowState = vbMinimized
End Sub
Private Sub Timer1_Timer()
On Error GoTo errhandler
Label1.Caption = Val(Label1.Caption) + 1
For i = 1 To 10
Clipboard.Clear
keybd_event vbKeySnapshot, 0, 0, 0
DoEvents
Set Image1.Picture = Clipboard.GetData(vbCFBitmap)
SavePicture Image1.Picture, "C:\Documents and Settings\Vivek\My Documents\screenshots\image" & i & ".bmp"
Next i
errhandler:
MsgBox " completed"
Timer1.Enabled = False
End Sub
Re: Screenshot-Help me hack!
Please stop bumping your threads.
Re: Screenshot-Help me hack!
Are you still using
Code:
Set Image1.Picture = Clipboard.GetData(vbCFBitmap)
I just ran your code, with
Code:
Image1.Picture = Clipboard.GetData(vbCFBitmap)
for 25 pictures, with the form being minimized in the 3rd one, and it didn't throw an error.
Re: Screenshot-Help me hack!
Quote:
Originally Posted by Al42
Are you still using
Code:
Set Image1.Picture = Clipboard.GetData(vbCFBitmap)
I just ran your code, with
Code:
Image1.Picture = Clipboard.GetData(vbCFBitmap)
for 25 pictures, with the form being minimized in the 3rd one, and it didn't throw an error.
That's what I pointed out in post #21.
Re: Screenshot-Help me hack!
I tried both the method set and without set. then also it is displaying error?It will give error when i minizmize the project and click on another window.
Re: Screenshot-Help me hack!
Quote:
Originally Posted by vivek_master146
I tried both the method set and without set. then also it is displaying error?It will give error when i minizmize the project and click on another window.
Did the error come out precisely when your application lost focus?
Re: Screenshot-Help me hack!
Yes error is displaying when i m mizinizing project and working in another window in both methods. error is "invalid property value" in this line:
vb Code:
SavePicture Image1.Picture, "C:\Documents and Settings\Vivek\My Documents\screenshots\image" & i & ".bmp"
1 Attachment(s)
Re: Screenshot-Help me hack!
I amattaching the project again.Please check.
1 Attachment(s)
Re: Screenshot-Help me hack!
Quote:
Originally Posted by vivek_master146
I amattaching the project again.Please check.
Your project gave me an error, but I have tried with my own and it's working, whether it's minimized or you click on another form. I have attched the form, try it out.