X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fe3d9123c6968b452a95133c635069d6f7ae8ea5..cda66071f17f062779a7009065e5ff7dd958440b:/src/msw/listbox.cpp diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 655dea6722..8a3588b32c 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -43,10 +43,8 @@ #include "wx/ownerdrw.h" #endif -#ifndef __TWIN32__ - #ifdef __GNUWIN32_OLD__ - #include "wx/msw/gnuwin32/extra.h" - #endif +#ifdef __GNUWIN32_OLD__ + #include "wx/msw/gnuwin32/extra.h" #endif IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl) @@ -159,7 +157,7 @@ bool wxListBox::Create(wxWindow *parent, wstyle |= LBS_NOINTEGRALHEIGHT; WXDWORD exStyle = 0; - (void) MSWGetStyle(style, & exStyle) ; + (void) MSWGetStyle(m_windowStyle, & exStyle) ; m_hWnd = (WXHWND)::CreateWindowEx(exStyle, wxT("LISTBOX"), NULL, wstyle , @@ -585,13 +583,15 @@ void wxListBox::SetHorizontalExtent(const wxString& s) oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle()); GetTextMetrics(dc, &lpTextMetric); - int i; - for (i = 0; i < m_noItems; i++) + + // FIXME: buffer overflow!! + wxChar buf[1024]; + for (int i = 0; i < m_noItems; i++) { - int len = (int)SendMessage(GetHwnd(), LB_GETTEXT, i, (LONG)wxBuffer); - wxBuffer[len] = 0; + int len = (int)SendMessage(GetHwnd(), LB_GETTEXT, i, (LPARAM)buf); + buf[len] = 0; SIZE extentXY; - ::GetTextExtentPoint(dc, (LPTSTR)wxBuffer, len, &extentXY); + ::GetTextExtentPoint(dc, buf, len, &extentXY); int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth); if (extentX > largestExtent) largestExtent = extentX;