GetSystemMetrics





VB.Net


Imports System.Runtime.InteropServices

Module GetSystemMetrics
    Const SM_CXSCREEN As Integer = 0
    Const SM_CYSCREEN As Integer = 1

        <DllImport("user32.dll")>
        Public Function GetSystemMetrics(ByVal nIndex As Integer) As Integer
        End Function

    Sub GetSystemMetrics_Main()
        Dim screenWidth As Integer = GetSystemMetrics(SM_CXSCREEN)
        Dim screenHeight As Integer = GetSystemMetrics(SM_CYSCREEN)

        Console.WriteLine("Screen width: " & screenWidth)
        Console.WriteLine("Screen height: " & screenHeight)
    End Sub
End Module