Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

screenshot capture 1

Status
Not open for further replies.

compnut24

Technical User
Jun 11, 2001
67
0
0
US
anyone have a program that can automatically take a screenshot and save it in a specified folder every 5 minutes, or at intervals i mean? i want to have my screenshot as part of my website...
 
Here's a mino reworking of an earlier thread (thread711-118908), that may be of some assistance:

Add a module to your project, and drop in the following code:
[tt]
Option Explicit


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_MENU = &H12
Private Const VK_SNAPSHOT = &H2C
Private Const KEYEVENTF_KEYUP = &H2
Public Const SnapScreen = &H0
Public Const SnapWindow = &H1

Public Function Snapshot(SnapType As Long) As StdPicture

If SnapType = SnapWindow Then keybd_event VK_MENU, 0, 0, 0 'Simulate pressing ALT

' Simulate pressing and releasing PrtScn
keybd_event VK_SNAPSHOT, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0

If SnapType = SnapWindow Then keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0 ' Simulate releasing ALT

DoEvents ' allow inserted keyboard events to be processed
Set Snapshot = Clipboard.GetData(0)

End Function
[/tt]
Now add a timer to a form, set the interval appropriately (you'll need to figure out for your self how to deal with intervals greater than approx 1 minute), and drop in the following code:
[tt]
Option Explicit

Private Sub Timer1_Timer()
Call SavePicture(Snapshot(SnapScreen), "c:\myscreensnapshot.bmp") ' Change the filename to whatever you like
End Sub
[/tt]

 
ok, i did what you guys suggested, but: is there anyway to convert this bitmap to a .jpg, or .gif before it saves? that way it will work on all browsers (not just IE) and it will have a faster loading time. does anyone know how to do this?
 
It get's a mite more complicated if you want to save it as a .jpg, and generally involves getting hold of a 3rd party control if you want to save as a .gif
 
Yup, I would just suggest getting one of those freeware ocx controls...it should do it for ya...=) Regards,
Anth:cool:ny
----------------------------------------
"You say [red]insanity[/red] like it's a BAD THING!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top