Public Function CheckRez(pixelWidth As Long, pixelHeight As Long) As Boolean
' Dim lngTwipsX As Long Dim lngTwipsY As Long ' ' converte i pixels in twips lngTwipsX = pixelWidth * 15 lngTwipsY = pixelHeight * 15 ' ' rileva la risoluzione corrente If lngTwipsX <> Screen.Width Then CheckRez = False Else If lngTwipsY <> Screen.Height Then CheckRez = False Else CheckRez = True End If End If ' End Function 'In seguito chiamata la funzione all'avvio del programma: If CheckRez(640, 480) = False Then MsgBox "Incorrect screen size!" Else MsgBox "Screen Resolution Matches!" End If Questa procedura serve per evitare che l'utente utilizzi il vostro programma nella risoluzione video sbagliata. Primo creare una funzione chiamata CheckRez: |