Click to See Complete Forum and Search --> : ComboBox ???


raitz
May 28th, 2004, 02:27 PM
Hi,

How get a handle to the listbox portion of a combobox ?

Thanks.

Ael_
May 29th, 2004, 04:47 PM
I don't think there is a .NET solution to that (except reflection).
I used API:
Importing:

[StructLayout(LayoutKind.Sequential)]
struct COMBOBOXINFO
{
public int cbSize;
public RECT rcItem;
public RECT rcButton;
public int stateButton;
public IntPtr hwndCombo;
public IntPtr hwndItem;
public IntPtr hwndList;
}
[StructLayout(LayoutKind.Sequential)]
struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[DllImport("User32.dll", SetLastError = true)]
static extern bool GetComboBoxInfo(IntPtr hwndCombo, out COMBOBOXINFO pcbi);

Calling:

GetComboBoxInfo(combo.Handle, out comboBoxInfo);
IntPtr ptrHandle=comboBoxInfo.hwndList);