Beginner Series.
Sometimes when you are trying to select a row in a listbox (CListBox) which is place in your by name <YourDialogName>, you might do all that should be done to select a row programatically. But when nothing else works, here is a short cut. You might notice that if you click on an entry in a list box, you selchanged method will be called. But when you do a "SetCurSel", it might not be called, because your row will not get selected. In that case the following short cut works. You may vary the time interval given in Sleep method based on your mouse configuration.
void <YourDialogName>::SelectRow(int row)
{
//COMMENT: listBox_URLis the name of the list box, whose row should be selected.
RECT r;
listBox_URL.GetItemRect(row,&r);
int x=r.left + 10, y= r.top+5;
const int lParam=y<<16 | x; // Infuse the X & Y co-ordinates into the lParam
const int wParam=0;
listBox_URL.SendMessage(WM_LBUTTONDOWN,wParam,lParam);
Sleep(20);
listBox_URL.SendMessage(WM_LBUTTONUP,wParam,lParam);
}