From e5072fa660a7a6aea702365c47ea6d4fc61b42df Mon Sep 17 00:00:00 2001 From: Andrew Nguyen Date: Tue, 17 May 2011 05:14:52 -0500 Subject: [PATCH] taskmgr: Remove all TCHAR macro usage in tab page code. --- programs/taskmgr/applpage.c | 129 ++++++++++++++++++++---------------- programs/taskmgr/perfpage.c | 12 ++-- programs/taskmgr/procpage.c | 28 ++++---- 3 files changed, 92 insertions(+), 77 deletions(-) diff --git a/programs/taskmgr/applpage.c b/programs/taskmgr/applpage.c index 9f058687a6f..3a51dd81134 100644 --- a/programs/taskmgr/applpage.c +++ b/programs/taskmgr/applpage.c @@ -60,7 +60,7 @@ BOOL bRestore /* Restore the window if it is minimized */ static void ApplicationPageUpdate(void) { /* Enable or disable the "End Task" & "Switch To" buttons */ - if (ListView_GetSelectedCount(hApplicationPageListCtrl)) + if (SendMessageW(hApplicationPageListCtrl, LVM_GETSELECTEDCOUNT, 0, 0)) { EnableWindow(hApplicationPageEndTaskButton, TRUE); EnableWindow(hApplicationPageSwitchToButton, TRUE); @@ -73,16 +73,18 @@ static void ApplicationPageUpdate(void) /* If we are on the applications tab, then the windows menu will */ /* be present on the menu bar so enable & disable the menu items */ - if (TabCtrl_GetCurSel(hTabWnd) == 0) + if (SendMessageW(hTabWnd, TCM_GETCURSEL, 0, 0) == 0) { HMENU hMenu; HMENU hWindowsMenu; + UINT count; hMenu = GetMenu(hMainWnd); hWindowsMenu = GetSubMenu(hMenu, 3); + count = SendMessageW(hApplicationPageListCtrl, LVM_GETSELECTEDCOUNT, 0, 0); /* Only one item selected */ - if (ListView_GetSelectedCount(hApplicationPageListCtrl) == 1) + if (count == 1) { EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEHORIZONTALLY, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED); EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEVERTICALLY, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED); @@ -92,7 +94,7 @@ static void ApplicationPageUpdate(void) EnableMenuItem(hWindowsMenu, ID_WINDOWS_BRINGTOFRONT, MF_BYCOMMAND|MF_ENABLED); } /* More than one item selected */ - else if (ListView_GetSelectedCount(hApplicationPageListCtrl) > 1) + else if (count > 1) { EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEHORIZONTALLY, MF_BYCOMMAND|MF_ENABLED); EnableMenuItem(hWindowsMenu, ID_WINDOWS_TILEVERTICALLY, MF_BYCOMMAND|MF_ENABLED); @@ -120,18 +122,19 @@ static void AddOrUpdateHwnd(HWND hWnd, WCHAR *wszTitle, HICON hIcon, BOOL bHung) HIMAGELIST hImageListLarge; HIMAGELIST hImageListSmall; LV_ITEMW item; - int i; + int i, count; BOOL bAlreadyInList = FALSE; BOOL bItemRemoved = FALSE; memset(&item, 0, sizeof(LV_ITEMW)); /* Get the image lists */ - hImageListLarge = ListView_GetImageList(hApplicationPageListCtrl, LVSIL_NORMAL); - hImageListSmall = ListView_GetImageList(hApplicationPageListCtrl, LVSIL_SMALL); + hImageListLarge = (HIMAGELIST)SendMessageW(hApplicationPageListCtrl, LVM_GETIMAGELIST, LVSIL_NORMAL, 0); + hImageListSmall = (HIMAGELIST)SendMessageW(hApplicationPageListCtrl, LVM_GETIMAGELIST, LVSIL_SMALL, 0); + count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0); /* Check to see if it's already in our list */ - for (i=0; i=0; i--) + for (i=SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0)-1; i>=0; i--) { memset(&item, 0, sizeof(LV_ITEMW)); item.mask = LVIF_IMAGE|LVIF_PARAM; @@ -205,12 +209,12 @@ static void AddOrUpdateHwnd(HWND hWnd, WCHAR *wszTitle, HICON hIcon, BOOL bHung) !IsWindowVisible(pAPLI->hWnd) || (GetParent(pAPLI->hWnd) != NULL) || (GetWindow(pAPLI->hWnd, GW_OWNER) != NULL) || - (GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)) + (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)) { ImageList_Remove(hImageListLarge, item.iItem); ImageList_Remove(hImageListSmall, item.iItem); - SendMessage(hApplicationPageListCtrl, LVM_DELETEITEM, item.iItem, 0); + SendMessageW(hApplicationPageListCtrl, LVM_DELETEITEM, item.iItem, 0); HeapFree(GetProcessHeap(), 0, pAPLI); bItemRemoved = TRUE; } @@ -223,7 +227,8 @@ static void AddOrUpdateHwnd(HWND hWnd, WCHAR *wszTitle, HICON hIcon, BOOL bHung) */ if (bItemRemoved) { - for (i=0; i 1) + else if (count > 1) { EnableMenuItem(hSubMenu, ID_WINDOWS_TILEHORIZONTALLY, MF_BYCOMMAND|MF_ENABLED); EnableMenuItem(hSubMenu, ID_WINDOWS_TILEVERTICALLY, MF_BYCOMMAND|MF_ENABLED); @@ -414,7 +421,6 @@ static void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam) LPNMHDR pnmh; LV_DISPINFOW* pnmdi; LPAPPLICATION_PAGE_LIST_ITEM pAPLI; - WCHAR wszNotResponding[255]; WCHAR wszRunning[255]; @@ -452,7 +458,7 @@ static void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam) case NM_RCLICK: - if (ListView_GetSelectedCount(hApplicationPageListCtrl) < 1) + if (SendMessageW(hApplicationPageListCtrl, LVM_GETSELECTEDCOUNT, 0, 0) < 1) { ApplicationPageShowContextMenu1(); } @@ -470,13 +476,13 @@ static void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam) break; } } - else if (pnmh->hwndFrom == ListView_GetHeader(hApplicationPageListCtrl)) + else if (pnmh->hwndFrom == (HWND)SendMessageW(hApplicationPageListCtrl, LVM_GETHEADER, 0, 0)) { switch (pnmh->code) { case NM_RCLICK: - if (ListView_GetSelectedCount(hApplicationPageListCtrl) < 1) + if (SendMessageW(hApplicationPageListCtrl, LVM_GETSELECTEDCOUNT, 0, 0) < 1) { ApplicationPageShowContextMenu1(); } @@ -487,7 +493,7 @@ static void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam) break; - case HDN_ITEMCLICK: + case HDN_ITEMCLICKW: SendMessageW(hApplicationPageListCtrl, LVM_SORTITEMS, 0, (LPARAM) ApplicationPageCompareFunc); bSortAscending = !bSortAscending; @@ -507,7 +513,7 @@ void RefreshApplicationPage(void) static void UpdateApplicationListControlViewSetting(void) { - DWORD dwStyle = GetWindowLong(hApplicationPageListCtrl, GWL_STYLE); + DWORD dwStyle = GetWindowLongW(hApplicationPageListCtrl, GWL_STYLE); dwStyle &= ~LVS_REPORT; dwStyle &= ~LVS_ICON; @@ -521,7 +527,7 @@ static void UpdateApplicationListControlViewSetting(void) else dwStyle |= LVS_REPORT; - SetWindowLong(hApplicationPageListCtrl, GWL_STYLE, dwStyle); + SetWindowLongW(hApplicationPageListCtrl, GWL_STYLE, dwStyle); RefreshApplicationPage(); } @@ -578,15 +584,16 @@ void ApplicationPage_OnWindowsTileHorizontally(void) { LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LV_ITEMW item; - int i; + int i, count; HWND* hWndArray; int nWndCount; + count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0); hWndArray = HeapAlloc(GetProcessHeap(), 0, - sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl)); + sizeof(HWND) * count); nWndCount = 0; - for (i=0; ihWnd, WM_CLOSE, 0, 0); + PostMessageW(pAPLI->hWnd, WM_CLOSE, 0, 0); } } } @@ -796,10 +810,11 @@ void ApplicationPage_OnGotoProcess(void) { LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL; LV_ITEMW item; - int i; + int i, count; /* NMHDR nmhdr; */ - for (i=0; i