GetClientRect





VB.Net


Imports System.Runtime.InteropServices

Module GetClientRect

    Private Structure RECT
        Dim Left As Integer
        Dim Top As Integer
        Dim Right As Integer
        Dim Bottom As Integer
    End Structure

    <DllImport("user32.dll")>
    Private Function GetClientRect(hWnd As IntPtr, ByRef lpRect As RECT) As Boolean
    End Function

    Public Sub GetClientRect_Main()
        Dim rect2 As New RECT
        GetClientRect(Form1.Handle, rect2)
        Console.WriteLine(rect2.Left.ToString + " " + rect2.Right.ToString + " " + rect2.Top.ToString + " " + rect2.Bottom.ToString)
    End Sub
End Module