* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <precomp.h>
+#include "precomp.h"
typedef struct
{
HWND hApplicationPageNewTaskButton; /* Application New Task button */
static int nApplicationPageWidth;
static int nApplicationPageHeight;
-static HANDLE hApplicationPageEvent = NULL; /* When this event becomes signaled then we refresh the app list */
static BOOL bSortAscending = TRUE;
DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter);
BOOL noApps;
int CALLBACK ApplicationPageCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
int ProcGetIndexByProcessId(DWORD dwProcessId);
+#ifdef RUN_APPS_PAGE
+static HANDLE hApplicationThread = NULL;
+static DWORD dwApplicationThread;
+#endif
+
#if 0
void SwitchToThisWindow (
HWND hWnd, /* Handle to the window that should be activated */
LV_COLUMN column;
WCHAR szTemp[256];
int cx, cy;
- HANDLE hRefreshThread = NULL;
switch (message) {
case WM_INITDIALOG:
UpdateApplicationListControlViewSetting();
/* Start our refresh thread */
- hRefreshThread = CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, NULL);
-
+#ifdef RUN_APPS_PAGE
+ hApplicationThread = CreateThread(NULL, 0, ApplicationPageRefreshThread, NULL, 0, &dwApplicationThread);
+#endif
return TRUE;
case WM_DESTROY:
- /* Close the event handle, this will make the */
- /* refresh thread exit when the wait fails */
- CloseHandle(hApplicationPageEvent);
- CloseHandle(hRefreshThread);
+ /* Close refresh thread */
+#ifdef RUN_APPS_PAGE
+ EndLocalThread(&hApplicationThread, dwApplicationThread);
+#endif
break;
case WM_COMMAND:
ApplicationPageOnNotify(wParam, lParam);
break;
+ case WM_KEYDOWN:
+ if (wParam == VK_DELETE)
+ ProcessPage_OnEndProcess();
+ break;
+
}
return 0;
void RefreshApplicationPage(void)
{
+#ifdef RUN_APPS_PAGE
/* Signal the event so that our refresh thread */
/* will wake up and refresh the application page */
- SetEvent(hApplicationPageEvent);
+ PostThreadMessage(dwApplicationThread, WM_TIMER, 0, 0);
+#endif
}
void UpdateApplicationListControlViewSetting(void)
DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter)
{
+ MSG msg;
INT i;
BOOL bItemRemoved = FALSE;
LV_ITEM item;
HIMAGELIST hImageListLarge;
HIMAGELIST hImageListSmall;
- /* Create the event */
- hApplicationPageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
-
/* If we couldn't create the event then exit the thread */
- if (!hApplicationPageEvent)
- return 0;
-
while (1)
{
- DWORD dwWaitVal;
-
- /* Wait on the event */
- dwWaitVal = WaitForSingleObject(hApplicationPageEvent, INFINITE);
-
- /* If the wait failed then the event object must have been */
- /* closed and the task manager is exiting so exit this thread */
- if (dwWaitVal == WAIT_FAILED)
+ /* Wait for an the event or application close */
+ if (GetMessage(&msg, NULL, 0, 0) <= 0)
return 0;
- if (dwWaitVal == WAIT_OBJECT_0)
+ if (msg.message == WM_TIMER)
{
- /* Reset our event */
- ResetEvent(hApplicationPageEvent);
-
/*
* FIXME:
*
void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
{
- int idctrl;
LPNMHDR pnmh;
- LPNM_LISTVIEW pnmv;
LV_DISPINFO* pnmdi;
LPAPPLICATION_PAGE_LIST_ITEM pAPLI;
WCHAR szMsg[256];
-
- idctrl = (int) wParam;
pnmh = (LPNMHDR) lParam;
- pnmv = (LPNM_LISTVIEW) lParam;
pnmdi = (LV_DISPINFO*) lParam;
if (pnmh->hwndFrom == hApplicationPageListCtrl) {
ApplicationPage_OnSwitchTo();
break;
+
+ case LVN_KEYDOWN:
+
+ if (((LPNMLVKEYDOWN)lParam)->wVKey == VK_DELETE)
+ ApplicationPage_OnEndTask();
+
+ break;
+
}
}
else if (pnmh->hwndFrom == ListView_GetHeader(hApplicationPageListCtrl))