[EXPLORER_NEW]

- Run file dialog in its own thread
- Correctly check MapWindowPoints return value
- Fix a warning
- Based on Andrew Green's GSoC branch

svn path=/trunk/; revision=57977
This commit is contained in:
Thomas Faber
2012-12-23 14:31:18 +00:00
parent 3165d0562b
commit 7629f2ac34
2 changed files with 53 additions and 18 deletions
+8 -8
View File
@@ -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;
+45 -10
View File
@@ -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;
}