Di bawah ini merupakan fungsi VB6 untuk mengetahui resolusi screen. Bagaimana implementasinya dalam Visual Basic 6.0? bisa kita simak kodenya di bawah ini:
Option Explicit
Public Function ScreenResolution(iWidth, iHeight) As String
iWidth = Screen.Width \ Screen.TwipsPerPixelX
iHeight = Screen.Height \ Screen.TwipsPerPixelY
ScreenResolution = "Screen Resolution:" + vbCrLf + vbCrLf + Str$(iWidth) + " x" + Str$(iHeight)
End Function
Contoh penggunaan fungsi di atas:
Private Sub Command1_Click()
Dim intWidth As Integer
Dim intHeight As Integer
MsgBox ScreenResolution(intWidth, intHeight)
MsgBox intWidth
MsgBox intHeight
End Sub