|
-
Jan 27th, 2002, 01:14 AM
#1
Thread Starter
PowerPoster
take screenshot of the desktop after every milisecond
I am trying to do that, but it's taking hell a lot of RAM space and slowing down my system. Is there any other faster way to do that so it does not take much RAM and does not slow down my system?
-
Jan 27th, 2002, 06:31 AM
#2
Anything running every milisecond is going to chew up resources. What are you trying to accomplish? Perhaps there is a better way.
-
Jan 27th, 2002, 06:45 AM
#3
-
Jan 27th, 2002, 07:58 AM
#4
-
Jan 27th, 2002, 08:02 AM
#5
Frenzied Member
This is actually a good question. I am going to attempt to write my own remote control program which will allow me to take control of any machines on a network.
This is the sort of thing that I would want. I don't know if ever millisecond is required. Perhaps every 250 milliseconds would be appropriate.
Mega.
"If at first you don't succeed, then skydiving is not for you"
-
Jan 27th, 2002, 08:07 AM
#6
Originally posted by [B]Staifour]/B]
i think that every millisecond is not the hard point Hack but taking the screenshot is
Taking the screen shot is the easy part. Here are two different ways. To save the screen as a bitmap...
VB Code:
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 VK_SNAPSHOT = &H2C
'Author: Dalin Nie (Edited by Matthew Gates)
'Origin: [url]http://www.vbcode.com[/url]
'Purpose: This function capture the screen or the active window of your computer. Programmatically and save it to a .bmp file.
'VB version: VB 6,VB 5,VB 4/32
'Save Screen As Bitmap
Private Function SaveScreen(ByVal theFile As String) As Boolean
On Error Resume Next
'To get the Entire Screen
Call keybd_event(vbKeySnapshot, 1, 0, 0)
'To get the Active Window
'Call keybd_event(vbKeySnapshot, 0, 0, 0)
SavePicture Clipboard.GetData(vbCFBitmap), theFile
SaveScreen = True
Exit Function
End Function
'Usage
Call SaveScreen("C:\Windows\Desktop\shot1.bmp")
To simply send to the clipboard, see MattT's post here
http://www.vbforums.com/showthread.p...t=print+screen
-
Jan 27th, 2002, 08:11 AM
#7
Fanatic Member
Like my ways
-
Jan 27th, 2002, 11:36 AM
#8
Thread Starter
PowerPoster
Right now, I am trying to write a program that will alow you to make a video of your desktop (so the frame rate does matter if you wanna get better video). This program can also be used to make a video of you playing a game but it won't work because today's games take hell a lot of RAM to work correctly, so I need some better code to make it work fast but not take more RAM.
-
Jan 27th, 2002, 11:49 AM
#9
first of all
i just want you to know that there are software that does that (try to find a software in the lotus collection i think)
secondly:
to make a video normally you don't use a frame rate greater than 25 so what you need is a timer with an interval of 40 that will read the code of Hack i suggest:
add a new folder to your C drive and call it TestDir
add a timer to your form and name it TestTimer and set it's interval to 40
add this code to the form
VB Code:
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 VK_SNAPSHOT = &H2C
Private Function SaveScreen(ByVal theFile As String) As Boolean
On Error Resume Next
Call keybd_event(vbKeySnapshot, 1, 0, 0)
SavePicture Clipboard.GetData(vbCFBitmap), theFile
SaveScreen = True
End Function
Private Sub TestTimer_Timer
DoEvents
Static Frame
TestTimer.Interval = 40
Frame = Frame + 1
Call SaveScreen("C:\TestDir\shot" & Frame & ".bmp")
End Sub
now goto that folder and see the results
hope it'll work (i didn't test Hack's code)
if it doesn't wotk try to change vbKeySnapshot in the SaveScreen function to VK_SNAPSHOT
tell me what happens
-
Jan 27th, 2002, 12:16 PM
#10
The picture isn't missing
i did something like what you asked for but the funny thing is where you would put the images. It would be at leat a 1.5 second wait to transfer a 2.5 meg (1024x768) across the network. Retrieval of the image is also difficult unless you number it and it will still be slowed down (ie ur screenshot is at 2 while it has captured 5 screenshots). And just saving to 1 picture will cause 'File already open' errors. Many aspects to think about.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jan 27th, 2002, 12:39 PM
#11
Thread Starter
PowerPoster
Originally posted by BuggyProgrammer
i did something like what you asked for but the funny thing is where you would put the images. It would be at leat a 1.5 second wait to transfer a 2.5 meg (1024x768) across the network. Retrieval of the image is also difficult unless you number it and it will still be slowed down (ie ur screenshot is at 2 while it has captured 5 screenshots). And just saving to 1 picture will cause 'File already open' errors. Many aspects to think about.
Acutally, I thought of something different for my upcoming chat program. it will just send 1 desktop picture at the start, and then it'll send a the x and y coordinates' colours that are different from the previous desktop picture, and then you send them over the network as ASCII text. I think that method will be a little faster but haven't tried the full program yet.
-
Jan 27th, 2002, 12:48 PM
#12
if i was the one programming that network program i would change the size of the picture (decrease it) then i will resize it after transfering it to the other computer on the same network so that it matches the screen, i know this will decrease the pictures quality but i think it is the faster way, also you can cahnge the extension of the pictures (or try to)
for the synchronizing thing that BuggyProgrammer said, well, you can add a text file that will save the number of the last saved picture, the other computer that is trying to retrieve the pictures will read the text file and load the picture depending on it
isn't it an idea ?? i think it is
-
Jan 27th, 2002, 12:52 PM
#13
Thread Starter
PowerPoster
Originally posted by Staifour
first of all
i just want you to know that there are software that does that (try to find a software in the lotus collection i think)
secondly:
to make a video normally you don't use a frame rate greater than 25 so what you need is a timer with an interval of 40 that will read the code of Hack i suggest:
add a new folder to your C drive and call it TestDir
add a timer to your form and name it TestTimer and set it's interval to 40
add this code to the form
VB Code:
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 VK_SNAPSHOT = &H2C
Private Function SaveScreen(ByVal theFile As String) As Boolean
On Error Resume Next
Call keybd_event(vbKeySnapshot, 1, 0, 0)
SavePicture Clipboard.GetData(vbCFBitmap), theFile
SaveScreen = True
End Function
Private Sub TestTimer_Timer
DoEvents
Static Frame
TestTimer.Interval = 40
Frame = Frame + 1
Call SaveScreen("C:\TestDir\shot" & Frame & ".bmp")
End Sub
now goto that folder and see the results
hope it'll work (i didn't test Hack's code)
if it doesn't wotk try to change vbKeySnapshot in the SaveScreen function to VK_SNAPSHOT
tell me what happens
Hmmm, this method is working hell a lot faster than the one I was using before in which you use "StretchBlt" to first copy the picture onto a picture box and then you save it as a file. I'll work on it more and then hopefully it will come out as a really fast method of creating a video.
Last edited by abdul; Jan 27th, 2002 at 12:56 PM.
Baaaaaaaaah
-
Jan 27th, 2002, 12:58 PM
#14
PowerPoster
2 questions.
1) Why do the pictures no contain the mouse? When you send a picture to the Clipboard the Cursor always disapears....and can you fix it?
2) Is there anyway to save the files as .JPG instead of BMP? BMP's take up way too much space.
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Jan 27th, 2002, 01:10 PM
#15
well
for the cusor i know why it doesn't appear
this code presses PrintScreen from the keyboard and PrintScreen doesn't take the cursor but i don't see the it as a problem, but if you want to knw where the cursor is you should use an API function that returns the mouse position and write a code that will draw the cursor
i think this is the way (not sure)
-
Jan 27th, 2002, 02:13 PM
#16
The picture isn't missing
i bltted a picture of the mouse to the picture then saved it so you can see the mouse.
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Jan 27th, 2002, 07:49 PM
#17
New Member
saving as JPGs
There's code at vbAccelerator.com for saving pictures as JPGs. It requires some DLL. But you can download it as a package with a demo project.
-
Jan 27th, 2002, 08:23 PM
#18
The picture isn't missing
converting takes more time too
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Nov 10th, 2003, 12:43 AM
#19
The picture isn't missing
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
|