|
-
Nov 21st, 2011, 07:46 AM
#1
Thread Starter
Junior Member
How do i save pictures from a picturebox that update every 2 sec from a a screenshot
pretty much what i said. here is some of the code that i have:
Code:
Public Function CaptureImage(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer) As Bitmap
Dim JPEG As New Bitmap(Width, Height)
Dim G As Graphics = Graphics.FromImage(JPEG)
G.CopyFromScreen(New Point(X, Y), New Point(0, 0), JPEG.Size)
G.Dispose() : Return JPEG
End Function
'--------------
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'--------------
' "screenshot" is the picturebox on form 3
Form3.screenshot.Image = CaptureImage(Form4.Location.X, Form4.Location.Y, Form4.ClientSize.Width, Form4.ClientSize.Height)
End Sub
when the timer hits a 2 second interval the picturebox on form 3 gets a new image from the screen shot that form 4 takes off of form4's area. i want the user to select a folder with the "folder browser dialog" and i want each frame capture to be saved to the folder (every 2 seconds) that the user chooses as "1.jpg, 2.jpg, 3.jpg" etc could you please give me a good idea and some code on how to do this thank you. p.s if you need a better idea or more code examples on what I'm trying to say, just ask. thanks again
-
Nov 21st, 2011, 07:49 AM
#2
Lively Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
try something like this: x = x + 1
-
Nov 21st, 2011, 07:52 AM
#3
Lively Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
screenshot.Save([type where should it be saved's folder])
* i will give u the full code, just give me few minutes
-
Nov 21st, 2011, 08:03 AM
#4
Thread Starter
Junior Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
thank you Doraemon i'll be waiting
-
Nov 21st, 2011, 08:10 AM
#5
Lively Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
create a control "folderbrowsedialog"
create a button named "button1", when you clicked on it, it will show up a folderbrowsedialog
Code:
Public Class form3
Dim x As Integer
Public Function CaptureImage(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer) As Bitmap
Dim JPEG As New Bitmap(Width, Height)
Dim G As Graphics = Graphics.FromImage(JPEG)
G.CopyFromScreen(New Point(X, Y), New Point(0, 0), JPEG.Size)
G.Dispose() : Return JPEG
End Function
'--------------
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'--------------
' "screenshot" is the picturebox on form 3
Me.screenshot.Image = CaptureImage(form4.Location.X, form4.Location.Y, form4.ClientSize.Width, form4.ClientSize.Height)
x = x + 1
screenshot.Image.Save(FolderBrowserDialog1.SelectedPath & "\" & x & ".jpg")
End Sub
Private Sub form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
form4.Show()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
FolderBrowserDialog1.ShowDialog()
Timer1.Start()
End Sub
End Class
rate me so i doesn't only have 
i need        
XD
Last edited by Doraemon; Nov 21st, 2011 at 08:14 AM.
-
Nov 21st, 2011, 08:21 AM
#6
Thread Starter
Junior Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
Thank you so much !! i've been making this program for about a week and this is the main feature and you just helped me figure it out... THANK YOU . how do you add friends on this forum you defiantly one of mine?
-
Nov 21st, 2011, 08:26 AM
#7
-
Nov 21st, 2011, 08:29 AM
#8
Thread Starter
Junior Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
Done and Done & good idea i didn't even know that
-
Nov 21st, 2011, 08:36 AM
#9
Lively Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
do you rated me? i still only have 5 point only
-
Nov 21st, 2011, 08:37 AM
#10
Thread Starter
Junior Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
i tried the link but this time ill click "rate this post"... did you accept my friend request ?
-
Nov 21st, 2011, 08:39 AM
#11
Thread Starter
Junior Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
yeah i clicked "rate this post" and it said "you can not give reputation to the same post twice" ??
-
Nov 21st, 2011, 08:42 AM
#12
Lively Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
then you give rate on all my post hahaha XD
addon, i had already added you
addon 2, you had reached 10 post!
-
Nov 21st, 2011, 08:49 AM
#13
Thread Starter
Junior Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
lol awsome, here's another question I want to basically want to stop the screenshot's of wm player when the video stops or even when the progress that i have gets to the end which it is coded to sync with the duration of the video. any idea on how to do that ?? this is what i have for the progressbar
vb Code:
'Form 1 Private Sub AxWindowsMediaPlayer1_PlayStateChange(ByVal sender As System.Object, _ ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) Handles AxWindowsMediaPlayer1.PlayStateChange If AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsPlaying Then Form3.ProgressBar1.Maximum = CInt(AxWindowsMediaPlayer1.Ctlcontrols.currentItem.duration) Form3.Timer1.Start() ElseIf AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsPaused Then Form3.Timer1.Stop() ElseIf AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then Form3.Timer1.Stop() Form3.ProgressBar1.Value = 0 End If End Sub 'Form 3 (with progress bar and picturebox) Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If Form1.AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsPlaying Then ProgressBar1.Value = CInt(Form1.AxWindowsMediaPlayer1.Ctlcontrols.currentPosition) End If End Sub
Thanks =)
-
Nov 21st, 2011, 08:54 AM
#14
Lively Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
can you create a new thread? addon, i still not understand what you saying, say more clearer?
-
Nov 21st, 2011, 08:59 AM
#15
Thread Starter
Junior Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
okay so what the program does is it takes a screenshot of the axwindowsmediaplayer plug-in every 2 seconds with a invisible form over the windows media player plug-in it then shows it on a picturebox and saves it to a jpeg every 2 seconds (which you helped me with :P) what i want it to do though is when the video stops playing i want it to stop making jpegs.
-
Nov 21st, 2011, 09:13 AM
#16
Lively Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
you can make it by comparing the difference between the image, code i will make it too ==, few minutes is required
or i can do it by another way... wait is still need ==
i had just reviewed your code, this should already does what it should does:
ElseIf AxWindowsMediaPlayer1.playState = WMPLib.WMPPlayState.wmppsStopped Then
Form3.Timer1.Stop()
if you really want me to edit whole project, please send me your project file
Last edited by Doraemon; Nov 21st, 2011 at 09:16 AM.
-
Nov 21st, 2011, 09:13 AM
#17
Thread Starter
Junior Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
Thanks man
-
Nov 21st, 2011, 09:50 AM
#18
Thread Starter
Junior Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
k obviously your preoccupied with something else now lol, i have to go to sleep now anyway it's 1:50 am in my time zone and i have to get up for school a 7:50 am so don't know how i'm gonna do that :S but it was a nice talk and i got some good expertise from you my friend. anyways signing off now... ill talk to you tomorrow and once again thank you so much for your help
-
Nov 21st, 2011, 09:51 AM
#19
Lively Member
Re: How do i save pictures from a picturebox that update every 2 sec from a a screens
Tags for this Thread
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
|