X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fe56156fb5c4e7024f2bb6dee4efe09de58c5e78..509da835c597ef3359d569866819395f64c2b0a4:/src/msw/combobox.cpp diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 7de89452e5..84b1bca018 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -438,21 +438,39 @@ bool wxComboBox::MSWShouldPreProcessMessage(WXMSG *pMsg) WXHWND wxComboBox::GetEditHWNDIfAvailable() const { +#if defined(WINVER) && WINVER >= 0x0500 + typedef BOOL (WINAPI *GetComboBoxInfo_t)(HWND, COMBOBOXINFO*); + static GetComboBoxInfo_t s_pfnGetComboBoxInfo = NULL; + static bool s_triedToLoad = false; + if ( !s_triedToLoad ) + { + s_triedToLoad = true; + wxLoadedDLL dllUser32("user32.dll"); + wxDL_INIT_FUNC(s_pfn, GetComboBoxInfo, dllUser32); + } + + if ( s_pfnGetComboBoxInfo ) + { + WinStruct info; + (*s_pfnGetComboBoxInfo)(GetHwnd(), &info); + return info.hwndItem; + } +#endif + + if (HasFlag(wxCB_SIMPLE)) + { + POINT pt; + pt.x = pt.y = 4; + return (WXHWND) ::ChildWindowFromPoint(GetHwnd(), pt); + } + // notice that a slightly safer alternative could be to use FindWindowEx() // but it's not available under WinCE so just take the first child for now // to keep one version of the code for all platforms and fix it later if // problems are discovered -#ifndef __WXWINCE__ - COMBOBOXINFO info; - info.cbSize = sizeof(COMBOBOXINFO); - - GetComboBoxInfo(GetHwnd(), & info); - return info.hwndItem; -#else // we assume that the only child of the combobox is the edit window return (WXHWND)::GetWindow(GetHwnd(), GW_CHILD); -#endif } WXHWND wxComboBox::GetEditHWND() const