X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b4bfa4522e2b7f88b555e98491135f8fff9a04de..7b35aa40a06a160ae4a8650c5820880a020697e3:/src/msw/choice.cpp diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index fc53d9298d..f57a180cac 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -200,13 +200,22 @@ void wxChoice::SetString(int n, const wxString& s) wxString wxChoice::GetString(int n) const { - size_t len = (size_t)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0); + int len = (int)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0); + wxString str; - if (len) { - if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n, - (LPARAM)str.GetWriteBuf(len)) == CB_ERR ) { + if ( len != CB_ERR && len > 0 ) + { + if ( ::SendMessage + ( + GetHwnd(), + CB_GETLBTEXT, + n, + (LPARAM)(wxChar *)wxStringBuffer(str, len) + ) == CB_ERR ) + { wxLogLastError(wxT("SendMessage(CB_GETLBTEXT)")); } + str.UngetWriteBuf(); } @@ -280,6 +289,7 @@ void wxChoice::DoSetSize(int x, int y, // wxWindows interpretation is different; also, getting the size returns // the _displayed_ size (NOT the drop down menu size) so // setting-getting-setting size would not work. + wxControl::DoSetSize(x, y, width, -1, sizeFlags); }