Author: hbelusca
Date: Sat Oct 13 13:35:55 2012
New Revision: 57553
URL:
http://svn.reactos.org/svn/reactos?rev=57553&view=rev
Log:
[RAPPS]
- Use COM for calling SHBrowseForFolder.
- Allow choosing a directory for downloading.
- Correct a typo in the name of a function.
Modified:
trunk/reactos/base/applications/rapps/CMakeLists.txt
trunk/reactos/base/applications/rapps/rapps.h
trunk/reactos/base/applications/rapps/settingsdlg.c
trunk/reactos/base/applications/rapps/winmain.c
Modified: trunk/reactos/base/applications/rapps/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/CM…
==============================================================================
--- trunk/reactos/base/applications/rapps/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/CMakeLists.txt [iso-8859-1] Sat Oct 13 13:35:55
2012
@@ -29,7 +29,7 @@
set_module_type(rapps win32gui UNICODE)
target_link_libraries(rapps uuid)
-add_importlibs(rapps advapi32 comctl32 gdi32 urlmon user32 shell32 shlwapi msvcrt
kernel32 ntdll)
+add_importlibs(rapps advapi32 comctl32 gdi32 urlmon user32 shell32 shlwapi ole32 msvcrt
kernel32 ntdll)
add_dependencies(rapps rappsmsg)
add_message_headers(ANSI rappsmsg.mc)
add_cd_file(TARGET rapps DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/base/applications/rapps/rapps.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/ra…
==============================================================================
--- trunk/reactos/base/applications/rapps/rapps.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/rapps.h [iso-8859-1] Sat Oct 13 13:35:55 2012
@@ -115,7 +115,7 @@
extern INT SelectedEnumType;
extern SETTINGS_INFO SettingsInfo;
VOID SaveSettings(HWND hwnd);
-VOID FillDafaultSettings(PSETTINGS_INFO pSettingsInfo);
+VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo);
/* listview.c */
extern HWND hListView;
Modified: trunk/reactos/base/applications/rapps/settingsdlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/se…
==============================================================================
--- trunk/reactos/base/applications/rapps/settingsdlg.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/settingsdlg.c [iso-8859-1] Sat Oct 13 13:35:55
2012
@@ -6,6 +6,7 @@
* PROGRAMMERS: Dmitry Chapyshev (dmitry(a)reactos.org)
*/
+#define _WIN32_DCOM // For CoInitializeEx, etc...
#include "rapps.h"
SETTINGS_INFO NewSettingsInfo;
@@ -16,27 +17,35 @@
BOOL
ChooseFolder(HWND hwnd)
{
- BROWSEINFO fi;
- LPCITEMIDLIST lpItemList;
+ BOOL bRet = FALSE;
+ BROWSEINFO bi;
WCHAR szPath[MAX_PATH], szBuf[MAX_STR_LEN];
LoadStringW(hInst, IDS_CHOOSE_FOLDER_TEXT, szBuf, sizeof(szBuf) / sizeof(TCHAR));
- ZeroMemory(&fi, sizeof(BROWSEINFO));
- fi.hwndOwner = hwnd;
- fi.lpszTitle = szBuf;
- fi.ulFlags = BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS | BIF_BROWSEFORCOMPUTER |
BIF_NEWDIALOGSTYLE;
- fi.lpfn = NULL;
- fi.lParam = -1;
- fi.iImage = 0;
+ ZeroMemory(&bi, sizeof(bi));
+ bi.hwndOwner = hwnd;
+ bi.pidlRoot = NULL;
+ bi.lpszTitle = szBuf;
+ bi.ulFlags = BIF_USENEWUI | BIF_DONTGOBELOWDOMAIN | BIF_RETURNONLYFSDIRS | /*
BIF_BROWSEFILEJUNCTIONS | */ BIF_VALIDATE;
- if (!(lpItemList = SHBrowseForFolder(&fi))) return FALSE;
- SHGetPathFromIDList(lpItemList, szPath);
+ if (SUCCEEDED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)))
+ {
+ LPITEMIDLIST lpItemList = SHBrowseForFolder(&bi);
+ if (lpItemList && SHGetPathFromIDList(lpItemList, szPath))
+ {
+ if (szPath[0] != 0)
+ {
+ SetDlgItemTextW(hwnd, IDC_DOWNLOAD_DIR_EDIT, szPath);
+ bRet = TRUE;
+ }
+ }
- if (wcslen(szPath) == 0) return FALSE;
- SetDlgItemTextW(hwnd, IDC_DOWNLOAD_DIR_EDIT, szPath);
+ CoTaskMemFree(lpItemList);
+ CoUninitialize();
+ }
- return TRUE;
+ return bRet;
}
static VOID
@@ -89,7 +98,7 @@
break;
case IDC_DEFAULT_SETTINGS:
- FillDafaultSettings(&NewSettingsInfo);
+ FillDefaultSettings(&NewSettingsInfo);
InitSettingsControls(hDlg, NewSettingsInfo);
break;
Modified: trunk/reactos/base/applications/rapps/winmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/wi…
==============================================================================
--- trunk/reactos/base/applications/rapps/winmain.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/winmain.c [iso-8859-1] Sat Oct 13 13:35:55 2012
@@ -16,7 +16,7 @@
VOID
-FillDafaultSettings(PSETTINGS_INFO pSettingsInfo)
+FillDefaultSettings(PSETTINGS_INFO pSettingsInfo)
{
pSettingsInfo->bSaveWndPos = TRUE;
pSettingsInfo->bUpdateAtStart = FALSE;
@@ -782,7 +782,7 @@
if (!LoadSettings())
{
- FillDafaultSettings(&SettingsInfo);
+ FillDefaultSettings(&SettingsInfo);
}
InitLogs();