Author: ashaposhnikov Date: Thu Jul 27 09:02:42 2017 New Revision: 75417
URL: http://svn.reactos.org/svn/reactos?rev=75417&view=rev Log: [RAPPS] - Added DownloadManager class (static for now) - Multiple selection launches multiple download dialogs (Checkbox selection has a priority over Selection when clicking Install) *A preperation for lauching a single dialog with a list of apps* - Show currently installing app in the dialog window
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc branches/GSoC_2017/rapps/reactos/base/applications/rapps/loaddlg.cpp branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/app... ============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/available.cpp [iso-8859-1] Thu Jul 27 09:02:42 2017 @@ -251,7 +251,7 @@ if (!DeleteCurrentAppsDB()) return FALSE;
- DownloadApplicationsDB(APPLICATION_DATABASE_URL); + DownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL);
if (m_szPath.IsEmpty()) return FALSE; @@ -280,7 +280,7 @@ if (hFind == INVALID_HANDLE_VALUE) { if (GetFileAttributesW(m_szCabPath) == INVALID_FILE_ATTRIBUTES) - DownloadApplicationsDB(APPLICATION_DATABASE_URL); + DownloadManager::DownloadApplicationsDB(APPLICATION_DATABASE_URL);
ExtractFilesFromCab(m_szCabPath, m_szAppsPath); hFind = FindFirstFileW(m_szSearchPath.GetString(), &FindFileData);
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/app... ============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/gui.cpp [iso-8859-1] Thu Jul 27 09:02:42 2017 @@ -458,7 +458,7 @@
BOOL GetCheckState(INT item) { - return (BOOL) GetItemState(item, LVIS_STATEIMAGEMASK); + return (BOOL) (GetItemState(item, LVIS_STATEIMAGEMASK) >> 12) - 1; }
VOID SetCheckState(INT item, BOOL fCheck) @@ -472,14 +472,15 @@ SetCheckState(-1, bHasAllChecked); }
- ATL::CAtlList<PAPPLICATION_INFO> GetCheckedItems() - { - ATL::CAtlList<PAPPLICATION_INFO> list; - for (INT i = 0; i != -1; i = GetNextItem(i, LVNI_ALL)) + ATL::CSimpleArray<PAPPLICATION_INFO> GetCheckedItems() + { + ATL::CSimpleArray<PAPPLICATION_INFO> list; + for (INT i = 0; i >= 0; i = GetNextItem(i, LVNI_ALL)) { if (GetCheckState(i) != FALSE) { - list.AddTail((PAPPLICATION_INFO) GetItemData(i)); + PAPPLICATION_INFO pAppInfo = (PAPPLICATION_INFO) GetItemData(i); + list.Add(pAppInfo); } } return list; @@ -1255,11 +1256,16 @@ break;
case ID_INSTALL: - if (DownloadApplication(-1)) - /* TODO: Implement install dialog - * if (InstallApplication(-1)) - */ + if (nSelectedApps) + { + DownloadManager::DownloadListOfApplications(m_ListView->GetCheckedItems()); UpdateApplicationsList(-1); + } + else if(DownloadManager::DownloadApplication((PAPPLICATION_INFO) m_ListView->GetSelectionMark())) + { + UpdateApplicationsList(-1); + } + break;
case ID_UNINSTALL: @@ -1403,11 +1409,10 @@ { if (m_StatusBar) { - ATL::CStringW szBuffer1, szBuffer2; - - szBuffer2.LoadStringW(hInst, IDS_APPS_COUNT); - szBuffer1.Format(szBuffer2, m_ListView->GetItemCount(), nSelectedApps); - m_StatusBar->SetText(szBuffer1); + ATL::CStringW szBuffer; + + szBuffer.Format(IDS_APPS_COUNT, m_ListView->GetItemCount(), nSelectedApps); + m_StatusBar->SetText(szBuffer); } }
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/app... ============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/en-US.rc [iso-8859-1] Thu Jul 27 09:02:42 2017 @@ -92,7 +92,7 @@
IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 72 STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE -CAPTION "Downloading..." +CAPTION "Downloading %ls..." FONT 8, "MS Shell Dlg" BEGIN CONTROL "Progress1", IDC_DOWNLOAD_PROGRESS, "msctls_progress32", WS_BORDER | PBS_SMOOTH, 10, 10, 200, 12 @@ -108,16 +108,6 @@ LTEXT "ReactOS Applications Manager\nCopyright (C) 2009\nby Dmitry Chapyshev (dmitry@reactos.org)", IDC_STATIC, 48, 7, 130, 39 PUSHBUTTON "Close", IDOK, 133, 46, 50, 14 ICON IDI_MAIN, IDC_STATIC, 10, 10, 7, 30 -END - -IDD_DOWNLOAD_DIALOG_MULTI DIALOGEX 0, 0, 220, 72 -STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION | WS_VISIBLE -CAPTION "Downloading (multiple)..." -FONT 8, "MS Shell Dlg" -BEGIN - CONTROL "Progress1", IDC_DOWNLOAD_PROGRESS, "msctls_progress32", WS_BORDER | PBS_SMOOTH, 10, 10, 200, 12 - EDITTEXT IDC_DOWNLOAD_STATUS, 10, 28, 200, 22, ES_CENTER | ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_DISABLED | NOT WS_BORDER - PUSHBUTTON "Cancel", IDCANCEL, 85, 53, 50, 15, WS_GROUP | WS_TABSTOP END
STRINGTABLE
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/app... ============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/ru-RU.rc [iso-8859-1] Thu Jul 27 09:02:42 2017 @@ -92,7 +92,7 @@
IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 72 STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_SYSMENU | WS_VISIBLE -CAPTION "ÐагÑÑзка..." +CAPTION "ÐагÑÑзка %ls..." FONT 8, "MS Shell Dlg" BEGIN CONTROL "Progress1", IDC_DOWNLOAD_PROGRESS, "msctls_progress32", WS_BORDER | PBS_SMOOTH, 10, 10, 200, 12
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/app... ============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/lang/uk-UA.rc [iso-8859-1] Thu Jul 27 09:02:42 2017 @@ -100,7 +100,7 @@
IDD_DOWNLOAD_DIALOG DIALOGEX 0, 0, 220, 72 STYLE DS_SHELLFONT | DS_CENTER | WS_POPUPWINDOW | WS_SYSMENU | WS_VISIBLE -CAPTION "ÐаванÑаженнÑ..." +CAPTION "ÐаванÑÐ°Ð¶ÐµÐ½Ð½Ñ %ls..." FONT 8, "MS Shell Dlg" BEGIN CONTROL "Progress1", IDC_DOWNLOAD_PROGRESS, "msctls_progress32", WS_BORDER | PBS_SMOOTH, 10, 10, 200, 12
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/loaddlg.cpp URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/app... ============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/loaddlg.cpp [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/loaddlg.cpp [iso-8859-1] Thu Jul 27 09:02:42 2017 @@ -38,8 +38,6 @@ #include <wininet.h> #include <shellutils.h> #include <windowsx.h> - -static PAPPLICATION_INFO AppInfo;
class CDownloadDialog : public CComObjectRootEx<CComMultiThreadModelNoCS>, @@ -250,9 +248,151 @@ MessageBoxW(hMainWnd, szMsgText.GetString(), NULL, MB_OK | MB_ICONERROR); }
-static -DWORD WINAPI -ThreadFunc(LPVOID Context) +// DownloadManager + +PAPPLICATION_INFO DownloadManager::AppInfo = NULL; + +INT_PTR CALLBACK DownloadManager::DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + HANDLE Thread; + DWORD ThreadId; + HWND Item; + + switch (uMsg) + { + case WM_INITDIALOG: + { + HICON hIconSm, hIconBg; + WCHAR szCaption[MAX_PATH]; + ATL::CStringW szNewCaption; + + hIconBg = (HICON) GetClassLongW(hMainWnd, GCLP_HICON); + hIconSm = (HICON) GetClassLongW(hMainWnd, GCLP_HICONSM); + + if (hIconBg && hIconSm) + { + SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) hIconBg); + SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSm); + } + + // Change caption to show the currently downloaded app + GetWindowTextW(Dlg, szCaption, MAX_PATH); + szNewCaption.Format(szCaption, AppInfo->szName.GetString()); + SetWindowTextW(Dlg, szNewCaption.GetString()); + + SetWindowLongW(Dlg, GWLP_USERDATA, 0); + Item = GetDlgItem(Dlg, IDC_DOWNLOAD_PROGRESS); + if (Item) + { + // initialize the default values for our nifty progress bar + // and subclass it so that it learns to print a status text + SendMessageW(Item, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); + SendMessageW(Item, PBM_SETPOS, 0, 0); + + SetWindowSubclass(Item, DownloadProgressProc, 0, 0); + } + + // add a neat placeholder until the download URL is retrieved + SetDlgItemTextW(Dlg, IDC_DOWNLOAD_STATUS, L"\x2022 \x2022 \x2022"); + + Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId); + if (!Thread) + return FALSE; + CloseHandle(Thread); + return TRUE; + } + case WM_COMMAND: + if (wParam == IDCANCEL) + { + SetWindowLongPtrW(Dlg, GWLP_USERDATA, 1); + PostMessageW(Dlg, WM_CLOSE, 0, 0); + } + return FALSE; + + case WM_CLOSE: + DestroyWindow(Dlg); + return TRUE; + + default: + return FALSE; + } +} + +LRESULT CALLBACK DownloadManager::DownloadProgressProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) +{ + static ATL::CStringW szProgressText; + + switch (uMsg) + { + case WM_SETTEXT: + { + if (lParam) + { + szProgressText = (PCWSTR) lParam; + } + return TRUE; + } + + case WM_ERASEBKGND: + case WM_PAINT: + { + PAINTSTRUCT ps; + HDC hDC = BeginPaint(hWnd, &ps), hdcMem; + HBITMAP hbmMem; + HANDLE hOld; + RECT myRect; + UINT win_width, win_height; + + GetClientRect(hWnd, &myRect); + + /* grab the progress bar rect size */ + win_width = myRect.right - myRect.left; + win_height = myRect.bottom - myRect.top; + + /* create an off-screen DC for double-buffering */ + hdcMem = CreateCompatibleDC(hDC); + hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height); + + hOld = SelectObject(hdcMem, hbmMem); + + /* call the original draw code and redirect it to our memory buffer */ + DefSubclassProc(hWnd, uMsg, (WPARAM) hdcMem, lParam); + + /* draw our nifty progress text over it */ + SelectFont(hdcMem, GetStockFont(DEFAULT_GUI_FONT)); + DrawShadowText(hdcMem, szProgressText.GetString(), szProgressText.GetLength(), + &myRect, + DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE, + GetSysColor(COLOR_CAPTIONTEXT), + GetSysColor(COLOR_3DSHADOW), + 1, 1); + + /* transfer the off-screen DC to the screen */ + BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY); + + /* free the off-screen DC */ + SelectObject(hdcMem, hOld); + DeleteObject(hbmMem); + DeleteDC(hdcMem); + + EndPaint(hWnd, &ps); + return 0; + } + + /* Raymond Chen says that we should safely unsubclass all the things! + (http://blogs.msdn.com/b/oldnewthing/archive/2003/11/11/55653.aspx) */ + case WM_NCDESTROY: + { + szProgressText.Empty(); + RemoveWindowSubclass(hWnd, DownloadProgressProc, uIdSubclass); + } + /* Fall-through */ + default: + return DefSubclassProc(hWnd, uMsg, wParam, lParam); + } +} + +DWORD WINAPI DownloadManager::ThreadFunc(LPVOID Context) { CComPtr<IBindStatusCallback> dl; ATL::CStringW Path; @@ -272,9 +412,15 @@ URL_COMPONENTS urlComponents; size_t urlLength, filenameLength;
+ if (!AppInfo) + { + MessageBox_LoadString(hMainWnd, IDS_UNABLE_TO_DOWNLOAD); + goto end; + } + /* build the path for the download */ - p = wcsrchr(AppInfo->szUrlDownload, L'/'); - q = wcsrchr(AppInfo->szUrlDownload, L'?'); + p = wcsrchr(AppInfo->szUrlDownload.GetString(), L'/'); + q = wcsrchr(AppInfo->szUrlDownload.GetString(), L'?');
/* do we have a final slash separator? */ if (!p) @@ -284,7 +430,7 @@ filenameLength = wcslen(p) * sizeof(WCHAR);
/* do we have query arguments in the target URL after the filename? account for them - (e.g. https://example.org/myfile.exe?no_adware_plz) */ + (e.g. https://example.org/myfile.exe?no_adware_plz) */ if (q && q > p && (q - p) > 0) filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
@@ -424,7 +570,7 @@ goto end;
/* if this thing isn't a RAPPS update and it has a SHA-1 checksum - verify its integrity by using the native advapi32.A_SHA1 functions */ + verify its integrity by using the native advapi32.A_SHA1 functions */ if (!bCab && AppInfo->szSHA1[0] != 0) { ATL::CStringW szMsgText; @@ -472,174 +618,49 @@ return 0; }
- -LRESULT CALLBACK -DownloadProgressProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) -{ - static ATL::CStringW szProgressText; - - switch (uMsg) - { - case WM_SETTEXT: - { - if (lParam) - { - szProgressText = (PCWSTR) lParam; - } - return TRUE; - } - - case WM_ERASEBKGND: - case WM_PAINT: - { - PAINTSTRUCT ps; - HDC hDC = BeginPaint(hWnd, &ps), hdcMem; - HBITMAP hbmMem; - HANDLE hOld; - RECT myRect; - UINT win_width, win_height; - - GetClientRect(hWnd, &myRect); - - /* grab the progress bar rect size */ - win_width = myRect.right - myRect.left; - win_height = myRect.bottom - myRect.top; - - /* create an off-screen DC for double-buffering */ - hdcMem = CreateCompatibleDC(hDC); - hbmMem = CreateCompatibleBitmap(hDC, win_width, win_height); - - hOld = SelectObject(hdcMem, hbmMem); - - /* call the original draw code and redirect it to our memory buffer */ - DefSubclassProc(hWnd, uMsg, (WPARAM) hdcMem, lParam); - - /* draw our nifty progress text over it */ - SelectFont(hdcMem, GetStockFont(DEFAULT_GUI_FONT)); - DrawShadowText(hdcMem, szProgressText.GetString(), szProgressText.GetLength(), - &myRect, - DT_CENTER | DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE, - GetSysColor(COLOR_CAPTIONTEXT), - GetSysColor(COLOR_3DSHADOW), - 1, 1); - - /* transfer the off-screen DC to the screen */ - BitBlt(hDC, 0, 0, win_width, win_height, hdcMem, 0, 0, SRCCOPY); - - /* free the off-screen DC */ - SelectObject(hdcMem, hOld); - DeleteObject(hbmMem); - DeleteDC(hdcMem); - - EndPaint(hWnd, &ps); - return 0; - } - - /* Raymond Chen says that we should safely unsubclass all the things! - (http://blogs.msdn.com/b/oldnewthing/archive/2003/11/11/55653.aspx) */ - case WM_NCDESTROY: - { - szProgressText.Empty(); - RemoveWindowSubclass(hWnd, DownloadProgressProc, uIdSubclass); - } - /* Fall-through */ - default: - return DefSubclassProc(hWnd, uMsg, wParam, lParam); - } -} - -static -INT_PTR CALLBACK -DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - HANDLE Thread; - DWORD ThreadId; - HWND Item; - - switch (uMsg) - { - case WM_INITDIALOG: - { - HICON hIconSm = NULL, hIconBg = NULL; - - hIconBg = (HICON) GetClassLongPtr(hMainWnd, GCLP_HICON); - hIconSm = (HICON) GetClassLongPtr(hMainWnd, GCLP_HICONSM); - - if (hIconBg && hIconSm) - { - SendMessageW(Dlg, WM_SETICON, ICON_BIG, (LPARAM) hIconBg); - SendMessageW(Dlg, WM_SETICON, ICON_SMALL, (LPARAM) hIconSm); - } - - SetWindowLongPtrW(Dlg, GWLP_USERDATA, 0); - Item = GetDlgItem(Dlg, IDC_DOWNLOAD_PROGRESS); - if (Item) - { - /* initialize the default values for our nifty progress bar - and subclass it so that it learns to print a status text */ - SendMessageW(Item, PBM_SETRANGE, 0, MAKELPARAM(0, 100)); - SendMessageW(Item, PBM_SETPOS, 0, 0); - - SetWindowSubclass(Item, DownloadProgressProc, 0, 0); - } - - /* add a neat placeholder until the download URL is retrieved */ - Item = GetDlgItem(Dlg, IDC_DOWNLOAD_STATUS); - SendMessageW(Item, WM_SETTEXT, 0, (LPARAM) L"\x2022 \x2022 \x2022"); - - Thread = CreateThread(NULL, 0, ThreadFunc, Dlg, 0, &ThreadId); - if (!Thread) - return FALSE; - CloseHandle(Thread); - return TRUE; - } - case WM_COMMAND: - if (wParam == IDCANCEL) - { - SetWindowLongPtrW(Dlg, GWLP_USERDATA, 1); - PostMessageW(Dlg, WM_CLOSE, 0, 0); - } +//TODO: Maybe launch this (similar function) in a seperate thread, so the list could be updated +BOOL DownloadManager::DownloadListOfApplications(const ATL::CSimpleArray<PAPPLICATION_INFO>& AppsList) +{ + BOOL bResult = TRUE; + + for (INT i = 0; i < AppsList.GetSize(); ++i) + { + bResult = DownloadApplication(AppsList[i]) && bResult; + } + return bResult; +} + +BOOL DownloadManager::DownloadApplication(PAPPLICATION_INFO pAppInfo) +{ + if (!pAppInfo) + { return FALSE; - - case WM_CLOSE: - DestroyWindow(Dlg); - return TRUE; - - default: - return FALSE; - } -} - -BOOL -DownloadApplication(INT Index) -{ - if (!IS_AVAILABLE_ENUM(SelectedEnumType)) - return FALSE; - - AppInfo = (PAPPLICATION_INFO) ListViewGetlParam(Index); - if (!AppInfo) - return FALSE; + } + + // Create a dialog and issue a download process + AppInfo = pAppInfo; + LaunchDownloadDialog();
WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_INSTALL, AppInfo->szName.GetString());
- CreateDialogW(hInst, - MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), - hMainWnd, - DownloadDlgProc); - return TRUE; }
-VOID -DownloadApplicationsDB(LPCWSTR lpUrl) +VOID DownloadManager::DownloadApplicationsDB(LPCWSTR lpUrl) { APPLICATION_INFO IntInfo; IntInfo.szUrlDownload = lpUrl;
AppInfo = &IntInfo;
+ LaunchDownloadDialog(); +} + +//TODO: Reuse the dialog +VOID DownloadManager::LaunchDownloadDialog() +{ CreateDialogW(hInst, - MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), - hMainWnd, - DownloadDlgProc); -} + MAKEINTRESOURCEW(IDD_DOWNLOAD_DIALOG), + hMainWnd, + DownloadDlgProc); +}
Modified: branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/rapps/reactos/base/app... ============================================================================== --- branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h [iso-8859-1] (original) +++ branches/GSoC_2017/rapps/reactos/base/applications/rapps/rapps.h [iso-8859-1] Thu Jul 27 09:02:42 2017 @@ -226,7 +226,7 @@ };
/* installdlg.cpp */ -BOOL InstallApplication(INT Index); +//BOOL InstallApplication(INT Index);
/* installed.cpp */ typedef BOOL (CALLBACK *APPENUMPROC)(INT ItemIndex, ATL::CStringW &lpName, PINSTALLED_INFO Info); @@ -249,8 +249,26 @@ VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo);
/* loaddlg.cpp */ -BOOL DownloadApplication(INT Index); -VOID DownloadApplicationsDB(LPCWSTR lpUrl); + +class DownloadManager +{ + static PAPPLICATION_INFO AppInfo; +public: + + static INT_PTR CALLBACK DownloadDlgProc(HWND Dlg, UINT uMsg, WPARAM wParam, LPARAM lParam); + static LRESULT CALLBACK DownloadProgressProc(HWND hWnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam, + UINT_PTR uIdSubclass, + DWORD_PTR dwRefData); + + static DWORD WINAPI ThreadFunc(LPVOID Context); + static BOOL DownloadListOfApplications(const ATL::CSimpleArray<PAPPLICATION_INFO>& AppsList); + static BOOL DownloadApplication(PAPPLICATION_INFO pAppInfo); + static VOID DownloadApplicationsDB(LPCWSTR lpUrl); + static VOID LaunchDownloadDialog(); +};
/* misc.cpp */ INT GetSystemColorDepth(VOID);