Delphi: How can I get a Handle for a TComboBox component?

As far as I know, Combobox consists of two components: Edit and ListBox. How can I get a Handle of Combobox if I have an Edit field handle? I tried using GetWindow (MyHandle, GW_HWNDNEXT), where MyHandle is the Edit descriptor that I know, but the result is always 0. Does anyone have any ideas?

thanks a lot.

+3
source share
3 answers

The "Edit" window is a child of the ComboBox window: use GetParent.

+3
source

TCustomCombo ListHandle EditHandle. , , :

type
  TCheatComboBox = class(TComboBox);

function GetListHandle(Combo: TComboBox): HWND;
begin
  Result := TCheatComboBox(Combo).ListHandle;
end;
+1

How did you get the Edit pen? If you execute Combobox1.Handle, you get a handle to the class window COMBOBOX.

Read http://msdn.microsoft.com/en-us/library/bb775792(VS.85).aspx

0
source

Source: https://habr.com/ru/post/1779401/


All Articles