2004-03-23 02:19:54 +01:00
|
|
|
/*
|
|
|
|
* ReactOS Task Manager
|
|
|
|
*
|
|
|
|
* run.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-03-23 02:19:54 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */
|
|
|
|
#include <windows.h>
|
|
|
|
#include <commctrl.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <memory.h>
|
|
|
|
#include <tchar.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "taskmgr.h"
|
|
|
|
|
|
|
|
typedef void (WINAPI *RUNFILEDLG)(
|
|
|
|
HWND hwndOwner,
|
|
|
|
HICON hIcon,
|
|
|
|
LPCSTR lpstrDirectory,
|
|
|
|
LPCSTR lpstrTitle,
|
|
|
|
LPCSTR lpstrDescription,
|
|
|
|
UINT uFlags);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Flags for RunFileDlg
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define RFF_NOBROWSE 0x01 /* Removes the browse button. */
|
|
|
|
#define RFF_NODEFAULT 0x02 /* No default item selected. */
|
|
|
|
#define RFF_CALCDIRECTORY 0x04 /* Calculates the working directory from the file name. */
|
|
|
|
#define RFF_NOLABEL 0x08 /* Removes the edit box label. */
|
|
|
|
#define RFF_NOSEPARATEMEM 0x20 /* Removes the Separate Memory Space check box (Windows NT only). */
|
|
|
|
|
|
|
|
void TaskManager_OnFileNew(void)
|
|
|
|
{
|
|
|
|
HMODULE hShell32;
|
|
|
|
RUNFILEDLG RunFileDlg;
|
|
|
|
OSVERSIONINFO versionInfo;
|
2009-08-24 06:55:22 +02:00
|
|
|
static const WCHAR wszShell32[] = {'S','H','E','L','L','3','2','.','D','L','L',0};
|
2004-03-23 02:19:54 +01:00
|
|
|
|
2009-08-24 06:55:22 +02:00
|
|
|
hShell32 = LoadLibraryW(wszShell32);
|
2010-05-18 01:30:51 +02:00
|
|
|
RunFileDlg = (void *)GetProcAddress(hShell32, (LPCSTR)61);
|
2004-03-23 02:19:54 +01:00
|
|
|
|
|
|
|
/* Show "Run..." dialog */
|
|
|
|
if (RunFileDlg)
|
|
|
|
{
|
2008-06-30 18:15:51 +02:00
|
|
|
HICON hIcon = LoadIconW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(IDI_TASKMANAGER));
|
2004-03-23 02:19:54 +01:00
|
|
|
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
|
|
|
GetVersionEx(&versionInfo);
|
|
|
|
|
|
|
|
if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
|
|
|
|
{
|
2008-06-27 19:25:55 +02:00
|
|
|
WCHAR wTitle[64];
|
|
|
|
LoadStringW(GetModuleHandleW(NULL), IDS_RUNDLG_CAPTION, wTitle, 64);
|
2008-06-30 18:15:51 +02:00
|
|
|
RunFileDlg(hMainWnd, hIcon, NULL, (LPCSTR)wTitle, NULL, RFF_CALCDIRECTORY);
|
2004-03-23 02:19:54 +01:00
|
|
|
}
|
|
|
|
else
|
2008-06-27 19:25:55 +02:00
|
|
|
{
|
|
|
|
char szTitle[64];
|
|
|
|
LoadStringA(GetModuleHandleW(NULL), IDS_RUNDLG_CAPTION, szTitle, 64);
|
2008-06-30 18:15:51 +02:00
|
|
|
RunFileDlg(hMainWnd, hIcon, NULL, szTitle, NULL, RFF_CALCDIRECTORY);
|
2008-06-27 19:25:55 +02:00
|
|
|
}
|
2004-03-23 02:19:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
FreeLibrary(hShell32);
|
|
|
|
}
|