ca6f00e869271f881d4dc1e6e4763888a7202e10
[reactos.git] / rosapps / taskmgr / run.cpp
1 /*
2 * ReactOS Task Manager
3 *
4 * run.cpp
5 *
6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23 #include "stdafx.h"
24 #include "taskmgr.h"
25 #include "run.h"
26
27 void TaskManager_OnFileNew(void)
28 {
29 HMODULE hShell32;
30 RUNFILEDLG RunFileDlg;
31 OSVERSIONINFO versionInfo;
32 WCHAR wTitle[40];
33 WCHAR wText[256];
34 char szTitle[40] = "Create New Task";
35 char szText[256] = "Type the name of a program, folder, document, or Internet resource, and Task Manager will open it for you.";
36
37 hShell32 = LoadLibrary("SHELL32.DLL");
38 RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (char*)((long)0x3D));
39
40 // Show "Run..." dialog
41 if (RunFileDlg)
42 {
43 versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
44 GetVersionEx(&versionInfo);
45
46 if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
47 {
48 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTitle, -1, wTitle, 40);
49 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szText, -1, wText, 256);
50 RunFileDlg(hMainWnd, 0, NULL, (LPCSTR)wTitle, (LPCSTR)wText, RFF_CALCDIRECTORY);
51 }
52 else
53 RunFileDlg(hMainWnd, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY);
54 }
55
56 FreeLibrary(hShell32);
57 }