fixed some compile problems with msvc 2003/2005
[reactos.git] / reactos / subsys / system / taskmgr / run.c
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24 #include "precomp.h"
25
26 void TaskManager_OnFileNew(void)
27 {
28 HMODULE hShell32;
29 RUNFILEDLG RunFileDlg;
30 TCHAR szTitle[40];
31 TCHAR szText[256];
32
33 /* Load language strings from resource file */
34 LoadString(hInst, IDS_CREATENEWTASK, szTitle, sizeof(szTitle) / sizeof(szTitle[0]));
35 LoadString(hInst, IDS_CREATENEWTASK_DESC, szText, sizeof(szText) / sizeof(szText[0]));
36
37
38 hShell32 = LoadLibrary(_T("SHELL32.DLL"));
39 RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (LPCSTR)0x3D);
40
41 /* Show "Run..." dialog */
42 if (RunFileDlg)
43 {
44 #ifndef UNICODE
45 if (GetVersion() < 0x80000000)
46 {
47 WCHAR wTitle[40];
48 WCHAR wText[256];
49
50 /* RunFileDlg is always unicode on NT systems, convert the ansi
51 strings to unicode */
52 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTitle, -1, wTitle, sizeof(szTitle) / sizeof(szTitle[0]));
53 MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szText, -1, wText, sizeof(szText) / sizeof(szText[0]));
54
55 RunFileDlg(hMainWnd, 0, NULL, wTitle, wText, RFF_CALCDIRECTORY);
56 }
57 else
58 {
59 /* RunFileDlg is ansi on win 9x systems */
60 RunFileDlg(hMainWnd, 0, NULL, (LPCWSTR)szTitle, (LPCWSTR)szText, RFF_CALCDIRECTORY);
61 }
62 #else
63 /* NOTE - don't check whether running on win 9x or NT, let's just
64 assume that a unicode build only runs on NT */
65 RunFileDlg(hMainWnd, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY);
66 #endif
67 }
68
69 FreeLibrary(hShell32);
70 }