6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
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.
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.
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.
23 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
39 typedef void (WINAPI
*RUNFILEDLG
)(
42 LPCSTR lpstrDirectory
,
44 LPCSTR lpstrDescription
,
48 // Flags for RunFileDlg
51 #define RFF_NOBROWSE 0x01 // Removes the browse button.
52 #define RFF_NODEFAULT 0x02 // No default item selected.
53 #define RFF_CALCDIRECTORY 0x04 // Calculates the working directory from the file name.
54 #define RFF_NOLABEL 0x08 // Removes the edit box label.
55 #define RFF_NOSEPARATEMEM 0x20 // Removes the Separate Memory Space check box (Windows NT only).
58 // Show "Run..." dialog
62 RUNFILEDLG RunFileDlg
;
63 OSVERSIONINFO versionInfo
;
66 CHAR szTitle
[40] = "Create New Task";
67 CHAR szText
[256] = "Type the name of a program, folder, document, or Internet resource, and Task Manager will open it for you.";
69 hShell32
= LoadLibrary(_T("SHELL32.DLL"));
70 RunFileDlg
= (RUNFILEDLG
)(FARPROC
)GetProcAddress(hShell32
, (CHAR
*)((long)0x3D));
72 versionInfo
.dwOSVersionInfoSize
= sizeof(OSVERSIONINFO
);
73 GetVersionEx(&versionInfo
);
74 if (versionInfo
.dwPlatformId
== VER_PLATFORM_WIN32_NT
) {
75 MultiByteToWideChar(CP_ACP
, MB_PRECOMPOSED
, szTitle
, -1, wTitle
, 40);
76 MultiByteToWideChar(CP_ACP
, MB_PRECOMPOSED
, szText
, -1, wText
, 256);
77 RunFileDlg(Globals
.hMainWnd
, 0, NULL
, (LPCSTR
)wTitle
, (LPCSTR
)wText
, RFF_CALCDIRECTORY
);
79 RunFileDlg(Globals
.hMainWnd
, 0, NULL
, szTitle
, szText
, RFF_CALCDIRECTORY
);
82 FreeLibrary(hShell32
);
87 typedef struct _SHELLEXECUTEINFO{
108 } SHELLEXECUTEINFO, *LPSHELLEXECUTEINFO;
111 BOOL
OpenTarget(HWND hWnd
, TCHAR
* target
)
114 SHELLEXECUTEINFO shExecInfo
;
116 memset(&shExecInfo
, 0, sizeof(shExecInfo
));
117 shExecInfo
.cbSize
= sizeof(shExecInfo
);
118 shExecInfo
.fMask
= 0;
119 shExecInfo
.hwnd
= hWnd
;
120 shExecInfo
.lpVerb
= NULL
;
121 shExecInfo
.lpFile
= target
;
122 shExecInfo
.lpParameters
= NULL
;
123 shExecInfo
.lpDirectory
= NULL
;
124 shExecInfo
.nShow
= SW_SHOW
;
125 shExecInfo
.hInstApp
= 0;
127 result
= ShellExecuteEx(&shExecInfo
);