+ LONG lLen = 0;
+ wxChar* zBuf;
+ wxString sResult;
+
+ wxCHECK_MSG( IsValid(n), wxEmptyString,
+ wxT("invalid index in wxListBox::GetClientData") );
+
+ lLen = LONGFROMMR(::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXTLENGTH, (MPARAM)n, (MPARAM)0));
+ zBuf = new wxChar[lLen + 1];
+ ::WinSendMsg(GetHwnd(), LM_QUERYITEMTEXT, MPFROM2SHORT((SHORT)n, (SHORT)lLen), (MPARAM)zBuf);
+ zBuf[lLen] = '\0';
+ sResult = zBuf;
+ delete [] zBuf;
+ return sResult;
+} // end of wxListBox::GetString
+
+void wxListBox::SetString(unsigned int n, const wxString& rsString)
+{
+ wxCHECK_RET( IsValid(n),
+ wxT("invalid index in wxListBox::SetString") );
+
+ //
+ // Remember the state of the item
+ //
+ bool bWasSelected = IsSelected(n);
+ void* pOldData = NULL;
+ wxClientData* pOldObjData = NULL;
+
+ if ( HasClientUntypedData() )
+ pOldData = GetClientData(n);
+ else if ( HasClientObjectData() )
+ pOldObjData = GetClientObject(n);
+
+ //
+ // Delete and recreate it
+ //
+ ::WinSendMsg( GetHwnd()
+ ,LM_DELETEITEM
+ ,(MPARAM)n
+ ,(MPARAM)0
+ );
+
+ int nNewN = n;
+
+ if (n == (m_nNumItems - 1))
+ nNewN = -1;
+
+ ::WinSendMsg( GetHwnd()
+ ,LM_INSERTITEM
+ ,(MPARAM)nNewN
+ ,(MPARAM)rsString.wx_str()
+ );
+
+ //
+ // Restore the client data
+ //
+ if (pOldData)
+ SetClientData(n, pOldData);
+ else if (pOldObjData)
+ SetClientObject(n, pOldObjData);
+
+ //
+ // We may have lost the selection
+ //
+ if (bWasSelected)
+ Select(n);
+} // end of wxListBox::SetString
+
+unsigned int wxListBox::GetCount() const