Commit e5072fa6 authored by Andrew Nguyen's avatar Andrew Nguyen Committed by Alexandre Julliard

taskmgr: Remove all TCHAR macro usage in tab page code.

parent a12ed578
......@@ -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<ListView_GetItemCount(hApplicationPageListCtrl); i++)
for (i=0; i<count; i++)
{
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_IMAGE|LVIF_PARAM;
......@@ -164,7 +167,8 @@ static void AddOrUpdateHwnd(HWND hWnd, WCHAR *wszTitle, HICON hIcon, BOOL bHung)
ImageList_ReplaceIcon(hImageListSmall, item.iItem, hIcon);
/* Update the list view */
SendMessageW(hApplicationPageListCtrl, LVM_REDRAWITEMS, 0, ListView_GetItemCount(hApplicationPageListCtrl));
count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
SendMessageW(hApplicationPageListCtrl, LVM_REDRAWITEMS, 0, count);
/* UpdateWindow(hApplicationPageListCtrl); */
InvalidateRect(hApplicationPageListCtrl, NULL, 0);
}
......@@ -185,14 +189,14 @@ static void AddOrUpdateHwnd(HWND hWnd, WCHAR *wszTitle, HICON hIcon, BOOL bHung)
ImageList_AddIcon(hImageListLarge, hIcon);
item.iImage = ImageList_AddIcon(hImageListSmall, hIcon);
item.pszText = LPSTR_TEXTCALLBACKW;
item.iItem = ListView_GetItemCount(hApplicationPageListCtrl);
item.iItem = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
item.lParam = (LPARAM)pAPLI;
SendMessageW(hApplicationPageListCtrl, LVM_INSERTITEMW, 0, (LPARAM) &item);
}
/* Check to see if we need to remove any items from the list */
for (i=ListView_GetItemCount(hApplicationPageListCtrl)-1; 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<ListView_GetItemCount(hApplicationPageListCtrl); i++)
count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (i=0; i<count; i++)
{
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_IMAGE;
......@@ -257,25 +262,25 @@ static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
!IsWindowVisible(hWnd) ||
(GetParent(hWnd) != NULL) ||
(GetWindow(hWnd, GW_OWNER) != NULL) ||
(GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW))
(GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW))
{
return TRUE; /* Skip this window */
}
/* Get the icon for this window */
hIcon = NULL;
SendMessageTimeout(hWnd, WM_GETICON, bLargeIcon ? ICON_BIG /*1*/ : ICON_SMALL /*0*/, 0, 0, 1000, (PDWORD_PTR)&hIcon);
SendMessageTimeoutW(hWnd, WM_GETICON, bLargeIcon ? ICON_BIG /*1*/ : ICON_SMALL /*0*/, 0, 0, 1000, (PDWORD_PTR)&hIcon);
if (!hIcon)
{
hIcon = (HICON)GetClassLongPtr(hWnd, bLargeIcon ? GCLP_HICON : GCLP_HICONSM);
if (!hIcon) hIcon = (HICON)GetClassLongPtr(hWnd, bLargeIcon ? GCLP_HICONSM : GCLP_HICON);
if (!hIcon) SendMessageTimeout(hWnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (PDWORD_PTR)&hIcon);
if (!hIcon) SendMessageTimeout(hWnd, WM_GETICON, bLargeIcon ? ICON_SMALL /*0*/ : ICON_BIG /*1*/, 0, 0, 1000, (PDWORD_PTR)&hIcon);
hIcon = (HICON)GetClassLongPtrW(hWnd, bLargeIcon ? GCLP_HICON : GCLP_HICONSM);
if (!hIcon) hIcon = (HICON)GetClassLongPtrW(hWnd, bLargeIcon ? GCLP_HICONSM : GCLP_HICON);
if (!hIcon) SendMessageTimeoutW(hWnd, WM_QUERYDRAGICON, 0, 0, 0, 1000, (PDWORD_PTR)&hIcon);
if (!hIcon) SendMessageTimeoutW(hWnd, WM_GETICON, bLargeIcon ? ICON_SMALL /*0*/ : ICON_BIG /*1*/, 0, 0, 1000, (PDWORD_PTR)&hIcon);
}
if (!hIcon)
hIcon = LoadIcon(hInst, bLargeIcon ? MAKEINTRESOURCE(IDI_WINDOW) : MAKEINTRESOURCE(IDI_WINDOWSM));
hIcon = LoadIconW(hInst, bLargeIcon ? MAKEINTRESOURCEW(IDI_WINDOW) : MAKEINTRESOURCEW(IDI_WINDOWSM));
bHung = FALSE;
......@@ -292,7 +297,7 @@ static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
static DWORD WINAPI ApplicationPageRefreshThread(void *lpParameter)
{
/* Create the event */
hApplicationPageEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
hApplicationPageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
/* If we couldn't create the event then exit the thread */
if (!hApplicationPageEvent)
......@@ -333,7 +338,7 @@ static void ApplicationPageShowContextMenu1(void)
GetCursorPos(&pt);
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_APPLICATION_PAGE_CONTEXT1));
hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_APPLICATION_PAGE_CONTEXT1));
hSubMenu = GetSubMenu(hMenu, 0);
if (TaskManagerSettings.View_LargeIcons)
......@@ -352,14 +357,16 @@ static void ApplicationPageShowContextMenu2(void)
{
HMENU hMenu;
HMENU hSubMenu;
UINT count;
POINT pt;
GetCursorPos(&pt);
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_APPLICATION_PAGE_CONTEXT2));
hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_APPLICATION_PAGE_CONTEXT2));
hSubMenu = GetSubMenu(hMenu, 0);
if (ListView_GetSelectedCount(hApplicationPageListCtrl) == 1)
count = SendMessageW(hApplicationPageListCtrl, LVM_GETSELECTEDCOUNT, 0, 0);
if (count == 1)
{
EnableMenuItem(hSubMenu, ID_WINDOWS_TILEHORIZONTALLY, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
EnableMenuItem(hSubMenu, ID_WINDOWS_TILEVERTICALLY, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
......@@ -368,7 +375,7 @@ static void ApplicationPageShowContextMenu2(void)
EnableMenuItem(hSubMenu, ID_WINDOWS_CASCADE, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
EnableMenuItem(hSubMenu, ID_WINDOWS_BRINGTOFRONT, MF_BYCOMMAND|MF_ENABLED);
}
else if (ListView_GetSelectedCount(hApplicationPageListCtrl) > 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; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
for (i=0; i<count; i++) {
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_STATE|LVIF_PARAM;
item.iItem = i;
......@@ -610,15 +617,16 @@ void ApplicationPage_OnWindowsTileVertically(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; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
for (i=0; i<count; i++) {
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_STATE|LVIF_PARAM;
item.iItem = i;
......@@ -642,9 +650,10 @@ void ApplicationPage_OnWindowsMinimize(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEMW item;
int i;
int i, count;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (i=0; i<count; i++) {
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_STATE|LVIF_PARAM;
item.iItem = i;
......@@ -663,9 +672,10 @@ void ApplicationPage_OnWindowsMaximize(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEMW item;
int i;
int i, count;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (i=0; i<count; i++) {
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_STATE|LVIF_PARAM;
item.iItem = i;
......@@ -684,15 +694,16 @@ void ApplicationPage_OnWindowsCascade(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; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
for (i=0; i<count; i++) {
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_STATE|LVIF_PARAM;
item.iItem = i;
......@@ -714,9 +725,10 @@ void ApplicationPage_OnWindowsBringToFront(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEMW item;
int i;
int i, count;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (i=0; i<count; i++) {
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_STATE|LVIF_PARAM;
item.iItem = i;
......@@ -738,9 +750,10 @@ void ApplicationPage_OnSwitchTo(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEMW item;
int i;
int i, count;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (i=0; i<count; i++) {
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_STATE|LVIF_PARAM;
item.iItem = i;
......@@ -775,9 +788,10 @@ void ApplicationPage_OnEndTask(void)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEMW item;
int i;
int i, count;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (i=0; i<count; i++) {
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_STATE|LVIF_PARAM;
item.iItem = i;
......@@ -786,7 +800,7 @@ void ApplicationPage_OnEndTask(void)
if (item.state & LVIS_SELECTED) {
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;
if (pAPLI) {
PostMessage(pAPLI->hWnd, 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<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
count = SendMessageW(hApplicationPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (i=0; i<count; i++) {
memset(&item, 0, sizeof(LV_ITEMW));
item.mask = LVIF_STATE|LVIF_PARAM;
item.iItem = i;
......@@ -817,12 +832,10 @@ void ApplicationPage_OnGotoProcess(void)
/*
* Switch to the process tab
*/
TabCtrl_SetCurFocus(hTabWnd, 1);
SendMessageW(hTabWnd, TCM_SETCURFOCUS, 1, 0);
/*
* FIXME: Select the process item in the list
*/
for (i=0; i<ListView_GetItemCount(hProcessPage); i++) {
}
}
}
......
......@@ -146,7 +146,7 @@ static DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
LoadStringW(hInst, IDS_STATUS_BAR_MEMORY_USAGE, wszMemUsage, sizeof(wszMemUsage)/sizeof(WCHAR));
/* Create the event */
hPerformancePageEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
hPerformancePageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
/* If we couldn't create the event then exit the thread */
if (!hPerformancePageEvent)
......@@ -344,11 +344,11 @@ PerformancePageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
/*
* Subclass graph buttons
*/
OldGraphWndProc = (WNDPROC)SetWindowLongPtr(hPerformancePageCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
SetWindowLongPtr(hPerformancePageMemUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
OldGraphCtrlWndProc = (WNDPROC)SetWindowLongPtr(hPerformancePageMemUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
SetWindowLongPtr(hPerformancePageCpuUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
return TRUE;
OldGraphWndProc = (WNDPROC)SetWindowLongPtrW(hPerformancePageCpuUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
SetWindowLongPtrW(hPerformancePageMemUsageGraph, GWLP_WNDPROC, (LONG_PTR)Graph_WndProc);
OldGraphCtrlWndProc = (WNDPROC)SetWindowLongPtrW(hPerformancePageMemUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
SetWindowLongPtrW(hPerformancePageCpuUsageHistoryGraph, GWLP_WNDPROC, (LONG_PTR)GraphCtrl_WndProc);
return TRUE;
case WM_COMMAND:
break;
......
......@@ -89,7 +89,7 @@ static void ProcessPageShowContextMenu(DWORD dwProcessId)
GetCursorPos(&pt);
GetSystemInfo(&si);
hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_PROCESS_PAGE_CONTEXT));
hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_PROCESS_PAGE_CONTEXT));
hSubMenu = GetSubMenu(hMenu, 0);
hPriorityMenu = GetSubMenu(hSubMenu, 4);
......@@ -152,8 +152,8 @@ static void ProcessPageOnNotify(LPARAM lParam)
{
LPNMHDR pnmh;
NMLVDISPINFOW* pnmdi;
LVITEM lvitem;
ULONG Index;
LVITEMW lvitem;
ULONG Index, Count;
ULONG ColumnIndex;
IO_COUNTERS iocounters;
TIME time;
......@@ -321,21 +321,21 @@ static void ProcessPageOnNotify(LPARAM lParam)
break;
case NM_RCLICK:
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (Index=0; Index<Count; Index++)
{
lvitem.mask = LVIF_STATE;
lvitem.stateMask = LVIS_SELECTED;
lvitem.iItem = Index;
lvitem.iSubItem = 0;
SendMessage(hProcessPageListCtrl, LVM_GETITEM, 0, (LPARAM) &lvitem);
SendMessageW(hProcessPageListCtrl, LVM_GETITEMW, 0, (LPARAM) &lvitem);
if (lvitem.state & LVIS_SELECTED)
break;
}
if ((ListView_GetSelectedCount(hProcessPageListCtrl) == 1) &&
if ((SendMessageW(hProcessPageListCtrl, LVM_GETSELECTEDCOUNT, 0, 0) == 1) &&
(PerfDataGetProcessId(Index) != 0))
{
ProcessPageShowContextMenu(PerfDataGetProcessId(Index));
......@@ -396,7 +396,7 @@ static DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR));
/* Create the event */
hProcessPageEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
hProcessPageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
/* If we couldn't create the event then exit the thread */
if (!hProcessPageEvent)
......@@ -419,8 +419,8 @@ static DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
/* Reset our event */
ResetEvent(hProcessPageEvent);
if ((ULONG)SendMessage(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount())
SendMessage(hProcessPageListCtrl, LVM_SETITEMCOUNT, PerfDataGetProcessCount(), /*LVSICF_NOINVALIDATEALL|*/LVSICF_NOSCROLL);
if (SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount())
SendMessageW(hProcessPageListCtrl, LVM_SETITEMCOUNT, PerfDataGetProcessCount(), /*LVSICF_NOINVALIDATEALL|*/LVSICF_NOSCROLL);
if (IsWindowVisible(hProcessPage))
InvalidateRect(hProcessPageListCtrl, NULL, FALSE);
......@@ -447,6 +447,7 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
int nXDifference;
int nYDifference;
int cx, cy;
DWORD extended_styles;
switch (message) {
case WM_INITDIALOG:
......@@ -464,21 +465,22 @@ ProcessPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
* Get handles to the controls
*/
hProcessPageListCtrl = GetDlgItem(hDlg, IDC_PROCESSLIST);
hProcessPageHeaderCtrl = ListView_GetHeader(hProcessPageListCtrl);
hProcessPageHeaderCtrl = (HWND)SendMessageW(hProcessPageListCtrl, LVM_GETHEADER, 0, 0);
hProcessPageEndProcessButton = GetDlgItem(hDlg, IDC_ENDPROCESS);
hProcessPageShowAllProcessesButton = GetDlgItem(hDlg, IDC_SHOWALLPROCESSES);
/*
* Set the extended window styles for the list control
*/
SendMessage(hProcessPageListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ListView_GetExtendedListViewStyle(hProcessPageListCtrl) | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
extended_styles = SendMessageW(hProcessPageListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
SendMessageW(hProcessPageListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, extended_styles | LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
AddColumns();
/*
* Subclass the process list control so we can intercept WM_ERASEBKGND
*/
OldProcessListWndProc = (WNDPROC)SetWindowLongPtr(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);
OldProcessListWndProc = (WNDPROC)SetWindowLongPtrW(hProcessPageListCtrl, GWLP_WNDPROC, (LONG_PTR)ProcessListWndProc);
/* Start our refresh thread */
CreateThread(NULL, 0, ProcessPageRefreshThread, NULL, 0, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment