Implement the Browse button, but it is not working well :(
authorHervé Poussineau <hpoussin@reactos.org>
Tue, 30 May 2006 13:39:21 +0000 (13:39 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Tue, 30 May 2006 13:39:21 +0000 (13:39 +0000)
svn path=/trunk/; revision=22117

reactos/dll/win32/newdev/newdev_private.h
reactos/dll/win32/newdev/wizard.c

index b707919..95fee8e 100644 (file)
@@ -8,6 +8,7 @@
 #include <regstr.h>
 #include <setupapi.h>
 #include <cfgmgr32.h>
+#include <shlobj.h>
 #include <tchar.h>
 #include <wine/debug.h>
 
index 42d1b6a..27bd3d6 100644 (file)
@@ -620,7 +620,7 @@ static void
 IncludePath(HWND Dlg, BOOL Enabled)
 {
        EnableWindow(GetDlgItem(Dlg, IDC_COMBO_PATH), Enabled);
-       EnableWindow(GetDlgItem(Dlg, IDC_BROWSE), /*FIXME: Enabled*/ FALSE);
+       EnableWindow(GetDlgItem(Dlg, IDC_BROWSE), Enabled);
 }
 
 static void
@@ -697,9 +697,35 @@ CHSourceDlgProc(
                                        return TRUE;
 
                                case IDC_BROWSE:
-                                       /* FIXME: set the IDC_COMBO_PATH text */
-                                       FIXME("Should display browse folder dialog\n");
-                                       return FALSE;
+                               {
+                                       BROWSEINFO bi = { 0, };
+                                       LPITEMIDLIST pidl;
+
+                                       bi.hwndOwner = hwndDlg;
+                                       bi.ulFlags = BIF_RETURNONLYFSDIRS;
+                                       pidl = SHBrowseForFolder(&bi);
+                                       if (pidl)
+                                       {
+                                               TCHAR Directory[MAX_PATH];
+                                               IMalloc* malloc;
+
+                                               if (SHGetPathFromIDList(pidl, Directory))
+                                               {
+                                                       /* Set the IDC_COMBO_PATH text */
+                                                       ComboBox_SetText(GetDlgItem(hwndDlg, IDC_COMBO_PATH), Directory);
+                                               }
+
+                                               /* Free memory, if possible */
+                                               if (SUCCEEDED(SHGetMalloc(&malloc)))
+                                               {
+                                                       FIXME("Memory leak!\n");
+                                                       //malloc->Free(pidl);
+                                                       //malloc->Release();
+                                               }
+                                               return TRUE;
+                                       }
+                                       break;
+                               }
                        }
                        break;
                }