0

I have sample code for GetComboBoxInfo from here

But am getting error code 87 at below code :

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

And always getting as IntPtr.Zero but above code is working fine in 32 bit operating system. Can you please help how to make above code work in 64 Bit Operating System.

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
Amarnath
  • 245
  • 3
  • 4
  • 15
  • I've use it with x86, x64 and any CPU without any problem. Take a look at [Cue banner/hint for ComboBox](https://stackoverflow.com/a/50972125/3110834) or [Combobox text align vertical center](https://stackoverflow.com/a/49820008/3110834). Also make sure when the code is running combo box handle has been created. – Reza Aghaei Feb 25 '19 at 05:10
  • 2
    Impossible for you to obtain an error code since you don't check for one. Unless your actual code is different. In which case what do you want help with? This code, or your actual code? Make a [MCVE] and the question is easy to answer. – David Heffernan Feb 25 '19 at 07:42
  • Did you set the `cbSize` of `COMBOBOXINFO` before using it? Can you show how you have declared this function, how the struct is initialize and where you're calling that method from? – Jimi Feb 25 '19 at 13:48
  • Thanks for comments.Sure working on the sample code will share shortly.. – Amarnath Feb 26 '19 at 05:22
  • Hi I created sample code with error here (https://drive.google.com/open?id=1KyfHS5Je8LVfNMpcVTc5FGDhll0Aa6p9). It is failing with error code 87 – Amarnath Jan 23 '20 at 05:28

0 Answers0