TITLEBARINFO (Structures)
Last changed: -219.91.161.164

.
Summary
The TITLEBARINFO structure contains title bar information.

C# Definition:

[StructLayout(LayoutKind.Sequential)]
struct TITLEBARINFO
{
    public const int CCHILDREN_TITLEBAR = 5;
    public uint cbSize;
    public RECT rcTitleBar;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst=CCHILDREN_TITLEBAR+1)]
    public uint[] rgstate;
}

VB Definition:

<StructLayout(LayoutKind.Sequential)> _
Structure TITLEBARINFO
   Public cbSize As Int32
   Public rcTitleBar As Rect
   Public rgState As TitleBarButtonStates
End Structure

User-Defined Field Types:

VB User-Defined Field Types:

<StructLayout(LayoutKind.Sequential)> _
Structure Rect
   Public Left, Top, Right, Bottom As Int32
   Public Function ToRectangle() As Rectangle
     Return Rectangle.FromLTRB(Left, Top, Right, Bottom)
   End Function
   Public Overrides Function ToString() As String
     Return "Rect: " & ToRectangle.ToString
   End Function
End Structure

<StructLayout(LayoutKind.Sequential)> _
Structure TitleBarButtonStates
   Public TitleBarState As TBBStates
   Public Reserved As TBBStates
   Public MinState As TBBStates
   Public MaxState As TBBStates
   Public HelpState As TBBStates
   Public CloseState As TBBStates
End Structure

Enum TBBStates
   STATE_SYSTEM_UNAVAILABLE = &H1
   STATE_SYSTEM_PRESSED = &H8
   STATE_SYSTEM_INVISIBLE = &H8000
   STATE_SYSTEM_OFFSCREEN = &H10000
   STATE_SYSTEM_FOCUSABLE = &H100000
End Enum

Notes:

Example Code

public Class Win32

{

        [StructLayout(LayoutKind.Sequential)]
        public    struct TITLEBARINFO
        {
            public const int CCHILDREN_TITLEBAR = 5;
            public uint cbSize;
            public RECT rcTitleBar;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst=CCHILDREN_TITLEBAR+1)]
            public uint[] rgstate;
        }

        [DllImport("User32.dll", CharSet = CharSet.Auto)]
        public static extern bool GetTitleBarInfo(IntPtr hwnd, ref TITLEBARINFO pti);

}

private void Form_Load(object sender, System.EventArgs e)

{

    Win32.TITLEBARINFO pti = new Win32.TITLEBARINFO();
    pti.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(pti);
    bool result = Win32.GetTitleBarInfo(Handle, ref pti);

}

Documentation