Hi,
I have this dialog:
ID__BATERIA __FAX DIALOGEX 0, 0, 235, 86
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Nueva batería de fax" FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,120,65,50,14 PUSHBUTTON "Cancel",IDCANCEL,175,65,50,14 LTEXT "Archivo",IDC_STATIC,20,12,25,8 LTEXT "Descripción",IDC_STATIC,20,40,37,8 EDITTEXT IDC_DESCBATER,65,38,120,13,ES_AUTOHSCROLL COMBOBOX IDC_ARCH2,65,10,120,60,CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
I want the combobox to be a file selector. So I wrote this:
BOOL CALLBACK BateriaFaxDlg(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam){
char descripcion[100];
char archivo[20];
switch (msg) /* manipulador del mensaje */
{
case WM_INITDIALOG:
SendMessage(GetDlgItem(hDlg, IDC_ARCH2), CB_DIR, DDL_READWRITE | DDL_DIRECTORY, (LPARAM)"*");
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
SendDlgItemMessage(hDlg, IDC_ARCH2, WM_GETTEXT, 20, (LPARAM)archivo);
GetDlgItemText(hDlg, IDC_DESCBATER, descripcion , 100);
actualizarBaterias("FAX", archivo, descripcion);
EndDialog(hDlg, FALSE);
break;
case IDCANCEL:
EndDialog(hDlg, FALSE);
break;
case IDC_ARCH2:
switch(HIWORD(wParam)) {
case CBN_DBLCLK:
if(DlgDirSelectEx(hDlg, archivo, 512, IDC_ARCH2)) {
// DlgDirList(hDlg, "*", IDC_ARCH2, ID_TITULO, DDL_DIRECTORY | DDL_DRIVES);
SendMessage(GetDlgItem(hDlg, IDC_ARCH2), CB_DIR, 0, (LPARAM)"*");
// IniciarLista(hwnd, cad);
}
break;
}
break;
default:
break;
return TRUE;
}
}
return FALSE;
}
It shows correctly the files and the directorys, but when I try to enter a directory it won't work. The thing I select is [dir] instead going inside and showing the files.
Can anyone help me?
Thanks a lot.
UPDATE:
Ok, I changed it and now it is a Simple ComboBox. Still when I double click on the directories it won't enter and list the files inside. Any ideas?
UPDATE:
It finally works.