xref: /reactos/base/applications/taskmgr/run.c (revision e5993f13)
1 /*
2  * PROJECT:     ReactOS Task Manager
3  * LICENSE:     LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
4  * PURPOSE:     Run Task.
5  * COPYRIGHT:   Copyright 1999-2001 Brian Palmer <brianp@reactos.org>
6  *              Copyright 2005 Klemens Friedl <frik85@reactos.at>
7  */
8 
9 #include "precomp.h"
10 
11 void TaskManager_OnFileNew(void)
12 {
13     HMODULE     hShell32;
14     RUNFILEDLG  RunFileDlg;
15     WCHAR       szTitle[40];
16     WCHAR       szText[256];
17 
18     /* Load language strings from resource file */
19     LoadStringW(hInst, IDS_CREATENEWTASK, szTitle, sizeof(szTitle) / sizeof(szTitle[0]));
20     LoadStringW(hInst, IDS_CREATENEWTASK_DESC, szText, sizeof(szText) / sizeof(szText[0]));
21 
22     hShell32 = LoadLibraryW(L"SHELL32.DLL");
23     RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (LPCSTR)61);
24 
25     /* Show "Run..." dialog */
26     if (RunFileDlg)
27     {
28         HICON hIcon = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER));
29 
30         /* NOTE - don't check whether running on win 9x or NT, let's just
31                   assume that a unicode build only runs on NT */
32         RunFileDlg(hMainWnd, hIcon, NULL, szTitle, szText, RFF_CALCDIRECTORY);
33 
34         DeleteObject(hIcon);
35     }
36 
37     FreeLibrary(hShell32);
38 }
39