Click to See Complete Forum and Search --> : Listbox Help -- Please


QuinnJohns
August 2nd, 2005, 09:56 PM
case IDC_CHANGEDIR:
{
TCHAR buf[512] = {0};

int iSelection = SendMessage(GetDlgItem(hDlg,IDC_LOCALDIRLIST), LB_GETCURSEL, 0, 0);

SendMessage(GetDlgItem(hDlg,IDC_LOCALDIRLIST), LB_GETTEXT, iSelection, reinterpret_cast<LPARAM>(buf));

_chdir(buf);
getcwd(CurrentDirectory,50-1);
SetDlgItemText(hDlg, IDC_LocalCWD, CurrentDirectory);
GetDirectoryListing(hDlg, CurrentDirectory);

}break;


Basically, I want to make it, so that when the user clicks my IDC_CHANGEDIR button, I want the object selected in my listbox, to be the object that the directory changes to. I figured this was correct, but it doesn't work. GetDirectoryListing...getcwd,_chdir -- all work correctly, I believe it deals with my SendMessage statements.

QuinnJohns
August 3rd, 2005, 02:09 AM
if(HIWORD(wParam) == LBN_DBLCLK)
{
if(LOWORD(wParam) == IDC_LOCALDIRLIST)
{
TCHAR buf[100] = "";
HWND hwndShift = GetDlgItem(hDlg,IDC_LOCALDIRLIST);
int iSelection = SendMessage(hwndShift, LB_GETCURSEL, 0, 6);

SendMessage(hwndShift,
LB_GETTEXT,
iSelection,
reinterpret_cast<LPARAM>(buf));

_chdir(buf);

getcwd(CurrentDirectory,50-1);
SetDlgItemText(hDlg, IDC_LocalCWD, CurrentDirectory);
GetDirectoryListing(hDlg, CurrentDirectory);
}
}

Fixed my problems. Thanks anyways.