Author: tfaber Date: Sun Dec 23 14:31:18 2012 New Revision: 57977
URL: http://svn.reactos.org/svn/reactos?rev=57977&view=rev Log: [EXPLORER_NEW] - Run file dialog in its own thread - Correctly check MapWindowPoints return value - Fix a warning - Based on Andrew Green's GSoC branch
Modified: trunk/reactos/base/shell/explorer-new/trayntfy.c trunk/reactos/base/shell/explorer-new/traywnd.c
Modified: trunk/reactos/base/shell/explorer-new/trayntfy.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/tra... ============================================================================== --- trunk/reactos/base/shell/explorer-new/trayntfy.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer-new/trayntfy.c [iso-8859-1] Sun Dec 23 14:31:18 2012 @@ -401,7 +401,7 @@ { UINT uiDueTime; BOOL Ret; - int intWait1, intWait2; + UINT uiWait1, uiWait2;
/* Kill the initialization timer */ KillTimer(This->hWnd, @@ -412,23 +412,23 @@
if (blShowSeconds == TRUE) { - intWait1 = 1000 - 200; - intWait2 = 1000; + uiWait1 = 1000 - 200; + uiWait2 = 1000; } else { - intWait1 = 60 * 1000 - 200; - intWait2 = 60 * 1000; - } - - if (uiDueTime > intWait1) + uiWait1 = 60 * 1000 - 200; + uiWait2 = 60 * 1000; + } + + if (uiDueTime > uiWait1) { /* The update of the clock will be up to 200 ms late, but that's acceptable. We're going to setup a timer that fires depending - intWait2. */ + uiWait2. */ Ret = SetTimer(This->hWnd, ID_TRAYCLOCK_TIMER, - intWait2, + uiWait2, NULL) != 0; This->IsTimerEnabled = Ret;
Modified: trunk/reactos/base/shell/explorer-new/traywnd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer-new/tra... ============================================================================== --- trunk/reactos/base/shell/explorer-new/traywnd.c [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer-new/traywnd.c [iso-8859-1] Sun Dec 23 14:31:18 2012 @@ -1883,6 +1883,40 @@ ITrayWindowImpl_Lock };
+static DWORD WINAPI +RunFileDlgThread(IN OUT PVOID pParam) +{ + ITrayWindowImpl *This = pParam; + HANDLE hShell32; + RUNFILEDLG RunFileDlg; + HWND hwnd; + RECT posRect; + + GetWindowRect(This->hwndStart,&posRect); + + hwnd = CreateWindowEx(0, + WC_STATIC, + NULL, + WS_OVERLAPPED | WS_DISABLED | WS_CLIPSIBLINGS | WS_BORDER | SS_LEFT, + posRect.left, + posRect.top, + posRect.right - posRect.left, + posRect.bottom - posRect.top, + NULL, + NULL, + NULL, + NULL); + + hShell32 = GetModuleHandle(TEXT("SHELL32.DLL")); + RunFileDlg = (RUNFILEDLG)GetProcAddress(hShell32, (LPCSTR)61); + + RunFileDlg(hwnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY); + + DestroyWindow(hwnd); + + return 0; +} + static LRESULT CALLBACK TrayWndProc(IN HWND hwnd, IN UINT uMsg, @@ -1936,12 +1970,13 @@ return HTBORDER; }
+ SetLastError(ERROR_SUCCESS); if (GetClientRect(hwnd, &rcClient) && - MapWindowPoints(hwnd, - NULL, - (LPPOINT)&rcClient, - 2) != 0) + (MapWindowPoints(hwnd, + NULL, + (LPPOINT)&rcClient, + 2) != 0 || GetLastError() == ERROR_SUCCESS)) { pt.x = (SHORT)LOWORD(lParam); pt.y = (SHORT)HIWORD(lParam); @@ -2382,13 +2417,13 @@
case IDM_RUN: { - HANDLE hShell32; - RUNFILEDLG RunFileDlg; - - hShell32 = GetModuleHandle(TEXT("SHELL32.DLL")); - RunFileDlg = (RUNFILEDLG)GetProcAddress(hShell32, (LPCSTR)61); - - RunFileDlg(hwnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY); + CloseHandle(CreateThread(NULL, + 0, + RunFileDlgThread, + This, + 0, + NULL)); + break; }