MFC C++ CListBox get selected item
<p>First let me say that I've been searching for a solution for couple of days now...</p>

<p>I'm trying to get selected item for ListBox. This is my code: </p>

<pre><code>CListBox * pList1 = (CListBox *)GetDlgItem(IDC_LIST1);
CString ItemSelected;
// Get the name of the item selected in the Sample Tables list box 
// and store it in the CString variable declared above 
pList1-&gt;GetText(pList1-&gt;GetCurSel(), ItemSelected);
MessageBox(ItemSelected, "TEST", MB_OK);
</code></pre>

<p>Now when i try this i get an error message saying "The Parameter is incorect"</p>