xref: /reactos/base/applications/taskmgr/run.c (revision c2c66aff)
1 /*
2  *  ReactOS Task Manager
3  *
4  *  run.c
5  *
6  *  Copyright (C) 1999 - 2001  Brian Palmer  <brianp@reactos.org>
7  *                2005         Klemens Friedl <frik85@reactos.at>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22  */
23 
24 #include "precomp.h"
25 
26 void TaskManager_OnFileNew(void)
27 {
28     HMODULE     hShell32;
29     RUNFILEDLG  RunFileDlg;
30     WCHAR       szTitle[40];
31     WCHAR       szText[256];
32 
33     /* Load language strings from resource file */
34     LoadStringW(hInst, IDS_CREATENEWTASK, szTitle, sizeof(szTitle) / sizeof(szTitle[0]));
35     LoadStringW(hInst, IDS_CREATENEWTASK_DESC, szText, sizeof(szText) / sizeof(szText[0]));
36 
37     hShell32 = LoadLibraryW(L"SHELL32.DLL");
38     RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (LPCSTR)61);
39 
40     /* Show "Run..." dialog */
41     if (RunFileDlg)
42     {
43         HICON hIcon = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER));
44 
45         /* NOTE - don't check whether running on win 9x or NT, let's just
46                   assume that a unicode build only runs on NT */
47         RunFileDlg(hMainWnd, hIcon, NULL, szTitle, szText, RFF_CALCDIRECTORY);
48 
49         DeleteObject(hIcon);
50     }
51 
52     FreeLibrary(hShell32);
53 }
54