Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

GetComboBoxInfo (user32)
 
.
Summary

C# Signature:

[DllImport("user32.dll")]
public static extern bool GetComboBoxInfo(IntPtr hWnd, ref COMBOBOXINFO pcbi);

VB.NET Signature

<DllImport("user32.dll")> _
Public Shared Function GetComboBoxInfo(ByVal hWnd As IntPtr, ByRef pcbi As COMBOBOXINFO) As Boolean
End Function

User-Defined Types (C#):

[DllImport("user32.dll")]

public static extern bool GetComboBoxInfo(IntPtr hWnd, ref COMBOBOXINFO pcbi);

User-Defined Types:

[StructLayout(LayoutKind.Sequential)]
public struct COMBOBOXINFO {
    public Int32 cbSize;
    public RECT rcItem;
    public RECT rcButton;
    public ComboBoxButtonState buttonState;
    public IntPtr hwndCombo;
    public IntPtr hwndEdit;
    public IntPtr hwndList;
}

public enum ComboBoxButtonState {
    STATE_SYSTEM_NONE = 0,
    STATE_SYSTEM_INVISIBLE = 0x00008000,
    STATE_SYSTEM_PRESSED = 0x00000008
}

User-Defined Types (VB.NET):

<StructLayout(LayoutKind.Sequential)> _
Public Structure COMBOBOXINFO
     Public cbSize As Int32
     Public rcItem As RECT
     Public rcButton As RECT
     Public buttonState As ComboBoxButtonState
     Public hwndCombo As IntPtr
     Public hwndEdit As IntPtr
     Public hwndList As IntPtr
End Structure

Public Enum ComboBoxButtonState
     STATE_SYSTEM_NONE = 0
     STATE_SYSTEM_INVISIBLE = &H8000
     STATE_SYSTEM_PRESSED = &H8
End Enum

RECT

Notes:

None.

Tips & Tricks:

Please add some!

RECT

Notes:

None.

Sample Code (C#):

COMBOBOXINFO cbi = new COMBOBOXINFO();
cbi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(cbi);
if(GetComboBoxInfo(comboBox1.Handle, ref cbi)) {
    if(cbi.hwndEdit == IntPtr.Zero) {
        throw new Exception("ComboBox must have the DropDown style!");
    }
}

Sample Code (VB.NET):

Dim cbi As COMBOBOXINFO
cbi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(cbi)
If GetComboBoxInfo(comboBox1.Handle, cbi) Then
     ...
End If

Alternative Managed API:

Do you know one? Please contribute it!

Tips & Tricks:

Please add some!

Documentation

Sample Code:

COMBOBOXINFO cbi = new COMBOBOXINFO();
cbi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(cbi);
if(GetComboBoxInfo(comboBox1.Handle, ref cbi)) {
    if(cbi.hwndEdit == IntPtr.Zero) {
        throw new Exception("ComboBox must have the DropDown style!");
    }
}

Alternative Managed API:

Do you know one? Please contribute it!

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions