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
29 void ProcessPage_OnEndProcess(void)
35 TCHAR strErrorText
[260];
37 for (Index
=0; Index
<(ULONG
)ListView_GetItemCount(hProcessPageListCtrl
); Index
++)
39 memset(&lvitem
, 0, sizeof(LVITEM
));
41 lvitem
.mask
= LVIF_STATE
;
42 lvitem
.stateMask
= LVIS_SELECTED
;
45 ListView_GetItem(hProcessPageListCtrl
, &lvitem
);
47 if (lvitem
.state
& LVIS_SELECTED
)
51 dwProcessId
= PerfDataGetProcessId(Index
);
53 if ((ListView_GetSelectedCount(hProcessPageListCtrl
) != 1) || (dwProcessId
== 0))
56 LoadString(hInst
, IDS_MSG_WARNINGTERMINATING
, szTemp
, 256);
57 LoadString(hInst
, IDS_MSG_TASKMGRWARNING
, szTempA
, 256);
58 if (MessageBox(hMainWnd
, szTemp
, szTempA
, MB_YESNO
|MB_ICONWARNING
) != IDYES
)
61 hProcess
= OpenProcess(PROCESS_TERMINATE
, FALSE
, dwProcessId
);
65 GetLastErrorText(strErrorText
, 260);
66 LoadString(hInst
, IDS_MSG_UNABLETERMINATEPRO
, szTemp
, 256);
67 MessageBox(hMainWnd
, strErrorText
, szTemp
, MB_OK
|MB_ICONSTOP
);
71 if (!TerminateProcess(hProcess
, 0))
73 GetLastErrorText(strErrorText
, 260);
74 LoadString(hInst
, IDS_MSG_UNABLETERMINATEPRO
, szTemp
, 256);
75 MessageBox(hMainWnd
, strErrorText
, szTemp
, MB_OK
|MB_ICONSTOP
);
78 CloseHandle(hProcess
);
81 void ProcessPage_OnEndProcessTree(void)
87 TCHAR strErrorText
[260];
89 for (Index
=0; Index
<(ULONG
)ListView_GetItemCount(hProcessPageListCtrl
); Index
++)
91 memset(&lvitem
, 0, sizeof(LVITEM
));
93 lvitem
.mask
= LVIF_STATE
;
94 lvitem
.stateMask
= LVIS_SELECTED
;
97 ListView_GetItem(hProcessPageListCtrl
, &lvitem
);
99 if (lvitem
.state
& LVIS_SELECTED
)
103 dwProcessId
= PerfDataGetProcessId(Index
);
105 if ((ListView_GetSelectedCount(hProcessPageListCtrl
) != 1) || (dwProcessId
== 0))
108 LoadString(hInst
, IDS_MSG_WARNINGTERMINATING
, szTemp
, 256);
109 LoadString(hInst
, IDS_MSG_TASKMGRWARNING
, szTempA
, 256);
110 if (MessageBox(hMainWnd
, szTemp
, szTempA
, MB_YESNO
|MB_ICONWARNING
) != IDYES
)
113 hProcess
= OpenProcess(PROCESS_TERMINATE
, FALSE
, dwProcessId
);
117 GetLastErrorText(strErrorText
, 260);
118 LoadString(hInst
, IDS_MSG_UNABLETERMINATEPRO
, szTemp
, 256);
119 MessageBox(hMainWnd
, strErrorText
, szTemp
, MB_OK
|MB_ICONSTOP
);
123 if (!TerminateProcess(hProcess
, 0))
125 GetLastErrorText(strErrorText
, 260);
126 LoadString(hInst
, IDS_MSG_UNABLETERMINATEPRO
, szTemp
, 256);
127 MessageBox(hMainWnd
, strErrorText
, szTemp
, MB_OK
|MB_ICONSTOP
);
130 CloseHandle(hProcess
);