Private Sub Cattura()
'Sub per catturare lo schermo intero
'
'Consente l'Autoredraw della Picture1
Picture1.AutoRedraw = True
'Setta come immagine della Picture1 lo screenshot dello schermo intero
StretchBlt Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, DC, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, vbSrcCopy
'Disattiva il Timer1
Timer1.Enabled = False
'Rende il form visibile
Me.Visible = True
'Salva temporaneamente l'immagine ottenuta
SavePicture Picture1.Image, App.Path & "\Catture temporanee\Cattura temporanea.bmp"
'Rende invisible il form
Me.Visible = False
'Mostra il form frmPartScreen
frmPartScreen.Show
ParteSchermo = False 'Setta la variabile ParteSchermo come false
End Sub
Private Sub Form_Load()
'Rende invisibile il form
Me.Visible = False
'Imposta due valori simbolici per settare al massimo la grandezza del form
'(soluzione forzata: con Screen.Width dava problemi)
Me.Height = 99999
Me.Width = 99999
'Sposta il form in alto a sinistra sullo schermo
Me.Top = 0
Me.Left = 0
'Rende la Picture1 grande come tutto il form
Picture1.Height = Me.Height
Picture1.Width = Me.Width
'Si ritrova l'handle DC dello schermo grafico (finestra 0) e lo si memorizza nella variabile DC
DC = GetDC(0)
'Attiva il Timer1
Timer1.Enabled = True
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Dealloca l'handle DC
ReleaseDC 0, DC
End Sub
Private Sub Form_Initialize()
'Rende il form in stile Xp
InitCommonControls
End Sub
Private Sub Timer1_Timer()
'Richiama la sub Cattura per catturare lo schermo intero
Cattura
End Sub