diff --git a/reactos/base/shell/explorer-new/trayntfy.c b/reactos/base/shell/explorer-new/trayntfy.c index 7aafa52462f..679fa6e53fc 100644 --- a/reactos/base/shell/explorer-new/trayntfy.c +++ b/reactos/base/shell/explorer-new/trayntfy.c @@ -401,7 +401,7 @@ TrayClockWnd_CalibrateTimer(IN OUT PTRAY_CLOCK_WND_DATA This) { UINT uiDueTime; BOOL Ret; - int intWait1, intWait2; + UINT uiWait1, uiWait2; /* Kill the initialization timer */ KillTimer(This->hWnd, @@ -412,23 +412,23 @@ TrayClockWnd_CalibrateTimer(IN OUT PTRAY_CLOCK_WND_DATA This) if (blShowSeconds == TRUE) { - intWait1 = 1000 - 200; - intWait2 = 1000; + uiWait1 = 1000 - 200; + uiWait2 = 1000; } else { - intWait1 = 60 * 1000 - 200; - intWait2 = 60 * 1000; + uiWait1 = 60 * 1000 - 200; + uiWait2 = 60 * 1000; } - if (uiDueTime > intWait1) + 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; diff --git a/reactos/base/shell/explorer-new/traywnd.c b/reactos/base/shell/explorer-new/traywnd.c index 21c3e27f2e4..0cdec7e3451 100644 --- a/reactos/base/shell/explorer-new/traywnd.c +++ b/reactos/base/shell/explorer-new/traywnd.c @@ -1883,6 +1883,40 @@ static const ITrayWindowVtbl ITrayWindowImpl_Vtbl = 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 @@ TrayWndProc(IN HWND hwnd, 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 @@ HandleTrayContextMenu: case IDM_RUN: { - HANDLE hShell32; - RUNFILEDLG RunFileDlg; + CloseHandle(CreateThread(NULL, + 0, + RunFileDlgThread, + This, + 0, + NULL)); - hShell32 = GetModuleHandle(TEXT("SHELL32.DLL")); - RunFileDlg = (RUNFILEDLG)GetProcAddress(hShell32, (LPCSTR)61); - - RunFileDlg(hwnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY); break; }