Ok grazie ragazzi! E scusate per il titolo omesso!
Ho trovato questo programmino qui che diciamo è ciò che cercavo (si chiama Tiny Screen Capture).
L'unica cosa è, se possibile, fare in modo che salvi in JPG anzichè BMP... come si può fare?
Qui c'è il pezzo di codice che credo interessi:
'save-to path
Public Path As String
'number incrementation for filename
Public increment As Integer
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub Form_Activate()
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
End Sub
Private Sub Form_Load()
'keep window on top
SetWindowPos Me.hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
'Call SetWindowPos(Me.hWnd, HWND_TOPMOST, 0&, 0&, 0&, 0&, FLAGS)
'set save-to path
If Right(App.Path, 1) = "\" Then
Path = App.Path
Else
Path = App.Path & "\"
End If
End Sub
Private Sub cmdcap_Click()
Dim handc As Long, h As Long, w As Long, r As RECT, continue As Boolean, filepath As String
frmCap.WindowState = vbMinimized
Handle = GetDesktopWindow
'get dc of window
handc = GetDC(Val(Handle))
'get window's dimensions
GetWindowRect Val(Handle), r
w = r.Right - r.Left
h = r.Bottom - r.Top
piccap.Width = w
piccap.Height = h
'paint window into piccap
BitBlt piccap.hDC, 0, 0, w, h, handc, 0, 0, SRCCOPY
'if file exists, add to increment until a new file is created.
continue = True
Do
filepath = Path & CStr(increment) & ".bmp"
If Dir(filepath) <> "" Then
increment = increment + 1
Else
continue = False
End If
Loop Until Not continue
'save the picture in piccap
SavePicture piccap.Image, filepath
frmCap.WindowState = vbNormal
End Sub
Private Sub piccap_Click()
End Sub


Rispondi quotando