Type a page name and press Enter. You'll jump to the page if it exists, or you can create it if it doesn't.
To create a page in a module other than user32, prefix the name with the module name and a period.
GetComboBoxInfo (user32)
.
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;
}
<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
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!
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!
The GetComboBoxInfo API
3/16/2007 8:25:10 AM - -64.29.177.8
An IntPtr is a pointer to a memory location (unmanaged) that adapts to the platform it is running on (64-bit, etc.) UNLIKE a standard int/Integer. You should always use this type for unmanaged calls that require it, even though an int will appear to work on your development machine.
1/13/2008 4:00:13 AM - Damon Carr-72.43.165.29
The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.
6/3/2013 5:41:04 PM - dahminator-75.174.65.168
The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.
6/3/2013 5:41:04 PM - dahminator-75.174.65.168
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).