6 * Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
7 * 2005 Klemens Friedl <frik85@reactos.at>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 void ProcessPage_OnEndProcess(void)
33 WCHAR strErrorText
[260];
35 for (Index
=0; Index
<(ULONG
)ListView_GetItemCount(hProcessPageListCtrl
); Index
++)
37 memset(&lvitem
, 0, sizeof(LVITEM
));
39 lvitem
.mask
= LVIF_STATE
;
40 lvitem
.stateMask
= LVIS_SELECTED
;
43 (void)ListView_GetItem(hProcessPageListCtrl
, &lvitem
);
45 if (lvitem
.state
& LVIS_SELECTED
)
49 dwProcessId
= PerfDataGetProcessId(Index
);
51 if ((ListView_GetSelectedCount(hProcessPageListCtrl
) != 1) || (dwProcessId
== 0))
54 LoadStringW(hInst
, IDS_MSG_WARNINGTERMINATING
, strErrorText
, 256);
55 LoadStringW(hInst
, IDS_MSG_TASKMGRWARNING
, szTitle
, 256);
56 if (MessageBoxW(hMainWnd
, strErrorText
, szTitle
, MB_YESNO
|MB_ICONWARNING
) != IDYES
)
59 hProcess
= OpenProcess(PROCESS_TERMINATE
, FALSE
, dwProcessId
);
63 GetLastErrorText(strErrorText
, 260);
64 LoadStringW(hInst
, IDS_MSG_UNABLETERMINATEPRO
, szTitle
, 256);
65 MessageBoxW(hMainWnd
, strErrorText
, szTitle
, MB_OK
|MB_ICONSTOP
);
69 if (!TerminateProcess(hProcess
, 0))
71 GetLastErrorText(strErrorText
, 260);
72 LoadStringW(hInst
, IDS_MSG_UNABLETERMINATEPRO
, szTitle
, 256);
73 MessageBoxW(hMainWnd
, strErrorText
, szTitle
, MB_OK
|MB_ICONSTOP
);
76 CloseHandle(hProcess
);
79 void ProcessPage_OnEndProcessTree(void)
86 WCHAR strErrorText
[260];
88 for (Index
=0; Index
<(ULONG
)ListView_GetItemCount(hProcessPageListCtrl
); Index
++)
90 memset(&lvitem
, 0, sizeof(LVITEM
));
92 lvitem
.mask
= LVIF_STATE
;
93 lvitem
.stateMask
= LVIS_SELECTED
;
96 (void)ListView_GetItem(hProcessPageListCtrl
, &lvitem
);
98 if (lvitem
.state
& LVIS_SELECTED
)
102 dwProcessId
= PerfDataGetProcessId(Index
);
104 if ((ListView_GetSelectedCount(hProcessPageListCtrl
) != 1) || (dwProcessId
== 0))
107 LoadStringW(hInst
, IDS_MSG_WARNINGTERMINATING
, strErrorText
, 256);
108 LoadStringW(hInst
, IDS_MSG_TASKMGRWARNING
, szTitle
, 256);
109 if (MessageBoxW(hMainWnd
, strErrorText
, szTitle
, MB_YESNO
|MB_ICONWARNING
) != IDYES
)
112 hProcess
= OpenProcess(PROCESS_TERMINATE
, FALSE
, dwProcessId
);
116 GetLastErrorText(strErrorText
, 260);
117 LoadStringW(hInst
, IDS_MSG_UNABLETERMINATEPRO
, szTitle
, 256);
118 MessageBoxW(hMainWnd
, strErrorText
, szTitle
, MB_OK
|MB_ICONSTOP
);
122 if (!TerminateProcess(hProcess
, 0))
124 GetLastErrorText(strErrorText
, 260);
125 LoadStringW(hInst
, IDS_MSG_UNABLETERMINATEPRO
, szTitle
, 256);
126 MessageBoxW(hMainWnd
, strErrorText
, szTitle
, MB_OK
|MB_ICONSTOP
);
129 CloseHandle(hProcess
);