Release 1.2-rc6.
[wine/gsoc-2012-control.git] / programs / taskmgr / run.c
blobdc8cf7be3b9c7052d08ea465f069f854f6a1d2cb
1 /*
2 * ReactOS Task Manager
4 * run.c
6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library 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 GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
24 #include <windows.h>
25 #include <commctrl.h>
26 #include <stdlib.h>
27 #include <memory.h>
28 #include <tchar.h>
29 #include <stdio.h>
31 #include "taskmgr.h"
33 typedef void (WINAPI *RUNFILEDLG)(
34 HWND hwndOwner,
35 HICON hIcon,
36 LPCSTR lpstrDirectory,
37 LPCSTR lpstrTitle,
38 LPCSTR lpstrDescription,
39 UINT uFlags);
42 * Flags for RunFileDlg
45 #define RFF_NOBROWSE 0x01 /* Removes the browse button. */
46 #define RFF_NODEFAULT 0x02 /* No default item selected. */
47 #define RFF_CALCDIRECTORY 0x04 /* Calculates the working directory from the file name. */
48 #define RFF_NOLABEL 0x08 /* Removes the edit box label. */
49 #define RFF_NOSEPARATEMEM 0x20 /* Removes the Separate Memory Space check box (Windows NT only). */
51 void TaskManager_OnFileNew(void)
53 HMODULE hShell32;
54 RUNFILEDLG RunFileDlg;
55 OSVERSIONINFO versionInfo;
56 static const WCHAR wszShell32[] = {'S','H','E','L','L','3','2','.','D','L','L',0};
58 hShell32 = LoadLibraryW(wszShell32);
59 RunFileDlg = (void *)GetProcAddress(hShell32, (LPCSTR)61);
61 /* Show "Run..." dialog */
62 if (RunFileDlg)
64 HICON hIcon = LoadIconW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(IDI_TASKMANAGER));
65 versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
66 GetVersionEx(&versionInfo);
68 if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
70 WCHAR wTitle[64];
71 LoadStringW(GetModuleHandleW(NULL), IDS_RUNDLG_CAPTION, wTitle, 64);
72 RunFileDlg(hMainWnd, hIcon, NULL, (LPCSTR)wTitle, NULL, RFF_CALCDIRECTORY);
74 else
76 char szTitle[64];
77 LoadStringA(GetModuleHandleW(NULL), IDS_RUNDLG_CAPTION, szTitle, 64);
78 RunFileDlg(hMainWnd, hIcon, NULL, szTitle, NULL, RFF_CALCDIRECTORY);
82 FreeLibrary(hShell32);