taskmgr: Add Japanese resource.
[wine] / programs / taskmgr / run.c
1 /*
2  *  ReactOS Task Manager
3  *
4  *  run.c
5  *
6  *  Copyright (C) 1999 - 2001  Brian Palmer  <brianp@reactos.org>
7  *
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.
12  *
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.
17  *
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
21  */
22     
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 <malloc.h>
28 #include <memory.h>
29 #include <tchar.h>
30 #include <stdio.h>
31     
32 #include "taskmgr.h"
33
34 typedef void (WINAPI *RUNFILEDLG)(
35 HWND    hwndOwner, 
36 HICON   hIcon, 
37 LPCSTR  lpstrDirectory, 
38 LPCSTR  lpstrTitle, 
39 LPCSTR  lpstrDescription,
40 UINT    uFlags); 
41
42 /*
43  * Flags for RunFileDlg
44  */
45
46 #define RFF_NOBROWSE            0x01    /* Removes the browse button. */
47 #define RFF_NODEFAULT           0x02    /* No default item selected. */
48 #define RFF_CALCDIRECTORY       0x04    /* Calculates the working directory from the file name. */
49 #define RFF_NOLABEL                     0x08    /* Removes the edit box label. */
50 #define RFF_NOSEPARATEMEM       0x20    /* Removes the Separate Memory Space check box (Windows NT only). */
51
52 void TaskManager_OnFileNew(void)
53 {
54     HMODULE            hShell32;
55     RUNFILEDLG        RunFileDlg;
56     OSVERSIONINFO    versionInfo;
57     WCHAR            wTitle[40];
58     WCHAR            wText[256];
59     char            szTitle[40] = "Create New Task";
60     char            szText[256] = "Type the name of a program, folder, document, or Internet resource, and Task Manager will open it for you.";
61
62     hShell32 = LoadLibrary(_T("SHELL32.DLL"));
63     RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (char*)((long)0x3D));
64
65     /* Show "Run..." dialog */
66     if (RunFileDlg)
67     {
68         versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
69         GetVersionEx(&versionInfo);
70
71         if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
72         {
73             MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTitle, -1, wTitle, 40);
74             MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szText, -1, wText, 256);
75             RunFileDlg(hMainWnd, 0, NULL, (LPCSTR)wTitle, (LPCSTR)wText, RFF_CALCDIRECTORY);
76         }
77         else
78             RunFileDlg(hMainWnd, 0, NULL, szTitle, szText, RFF_CALCDIRECTORY);
79     }
80
81     FreeLibrary(hShell32);
82 }