case IDC_LIST1: { switch (HIWORD(wParam)) { case LBN_DBLCLK: { HWND hwndList = GetDlgItem(hDlg, IDC_LIST1); // Get selected index. int lbItem = (int)SendMessage(hwndList, LB_GETCURSEL, 0, 0); // display item's text TCHAR buff[MAX_PATH]; SendMessage(hwndList, LB_GETTEXT, lbItem, (LPARAM)buff); SetDlgItemText(hDlg, IDC_EDIT1, buff); return TRUE; } } } return TRUE;
左键双击后,获取控件的名称