run.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <windows.h>
  25. #include <commctrl.h>
  26. #include "taskmgr.h"
  27. typedef void (WINAPI *RUNFILEDLG)(
  28. HWND hwndOwner,
  29. HICON hIcon,
  30. LPCSTR lpstrDirectory,
  31. LPCSTR lpstrTitle,
  32. LPCSTR lpstrDescription,
  33. UINT uFlags);
  34. /*
  35. * Flags for RunFileDlg
  36. */
  37. #define RFF_NOBROWSE 0x01 /* Removes the browse button. */
  38. #define RFF_NODEFAULT 0x02 /* No default item selected. */
  39. #define RFF_CALCDIRECTORY 0x04 /* Calculates the working directory from the file name. */
  40. #define RFF_NOLABEL 0x08 /* Removes the edit box label. */
  41. #define RFF_NOSEPARATEMEM 0x20 /* Removes the Separate Memory Space check box (Windows NT only). */
  42. void TaskManager_OnFileNew(void)
  43. {
  44. RUNFILEDLG RunFileDlg;
  45. OSVERSIONINFOW versionInfo;
  46. RunFileDlg = (void *)GetProcAddress(GetModuleHandleW(L"shell32.dll"), (LPCSTR)61);
  47. /* Show "Run..." dialog */
  48. if (RunFileDlg)
  49. {
  50. HICON hIcon = LoadIconW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(IDI_TASKMANAGER));
  51. versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
  52. GetVersionExW(&versionInfo);
  53. if (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT)
  54. {
  55. WCHAR wTitle[64];
  56. LoadStringW(GetModuleHandleW(NULL), IDS_RUNDLG_CAPTION, wTitle, 64);
  57. RunFileDlg(hMainWnd, hIcon, NULL, (LPCSTR)wTitle, NULL, RFF_CALCDIRECTORY);
  58. }
  59. else
  60. {
  61. char szTitle[64];
  62. LoadStringA(GetModuleHandleW(NULL), IDS_RUNDLG_CAPTION, szTitle, 64);
  63. RunFileDlg(hMainWnd, hIcon, NULL, szTitle, NULL, RFF_CALCDIRECTORY);
  64. }
  65. }
  66. }