Author: tfaber Date: Wed Jan 23 21:07:37 2013 New Revision: 58208
URL: http://svn.reactos.org/svn/reactos?rev=58208&view=rev Log: [EXPLORER_NEW] - Do not allow multiple run dialogs. Based on patch by Edijs Kolesnikovičs & Grégori Macário Harbs. CORE-6871 #resolve
Modified: trunk/reactos/base/shell/explorer-new/traywnd.c
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] Wed Jan 23 21:07:37 2013 @@ -93,6 +93,7 @@ HBITMAP hbmStartMenu;
HWND hWndTrayProperties; + HWND hwndRunFileDlgOwner; } ITrayWindowImpl;
BOOL LaunchCPanel(HWND hwnd, LPCTSTR applet) @@ -2000,14 +2001,35 @@ NULL, NULL);
+ This->hwndRunFileDlgOwner = hwnd; + hShell32 = GetModuleHandle(TEXT("SHELL32.DLL")); RunFileDlg = (RUNFILEDLG)GetProcAddress(hShell32, (LPCSTR)61);
RunFileDlg(hwnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY);
+ This->hwndRunFileDlgOwner = NULL; DestroyWindow(hwnd);
return 0; +} + +static void +ITrayWindowImpl_ShowRunFileDlg(IN ITrayWindowImpl *This) +{ + HWND hRunDlg; + if (This->hwndRunFileDlgOwner) + { + hRunDlg = GetLastActivePopup(This->hwndRunFileDlgOwner); + if (hRunDlg != NULL && + hRunDlg != This->hwndRunFileDlgOwner) + { + SetForegroundWindow(hRunDlg); + return; + } + } + + CloseHandle(CreateThread(NULL, 0, RunFileDlgThread, This, 0, NULL)); }
static LRESULT CALLBACK @@ -2529,13 +2551,7 @@
case IDM_RUN: { - CloseHandle(CreateThread(NULL, - 0, - RunFileDlgThread, - This, - 0, - NULL)); - + ITrayWindowImpl_ShowRunFileDlg(This); break; }
@@ -2782,7 +2798,7 @@ switch (Msg.wParam) { case IDHK_RUN: /* Win+R */ - CloseHandle(CreateThread(NULL, 0, RunFileDlgThread, This, 0, NULL)); + ITrayWindowImpl_ShowRunFileDlg(This); break; } }