update the visual service count when a service is deleted

svn path=/trunk/; revision=28671
This commit is contained in:
Ged Murphy 2007-08-30 13:39:59 +00:00
parent 5bdb637cb7
commit 1fc9170197
5 changed files with 52 additions and 40 deletions

View file

@ -318,17 +318,21 @@ CreateDialogProc(HWND hDlg,
{
case WM_INITDIALOG:
{
hIcon = (HICON) LoadImage(hInstance,
MAKEINTRESOURCE(IDI_SM_ICON),
IMAGE_ICON,
16,
16,
0);
hIcon = (HICON)LoadImage(hInstance,
MAKEINTRESOURCE(IDI_SM_ICON),
IMAGE_ICON,
16,
16,
0);
if (hIcon)
{
SendMessage(hDlg,
WM_SETICON,
ICON_SMALL,
(LPARAM)hIcon);
DestroyIcon(hIcon);
}
SendMessage(hDlg,
WM_SETICON,
ICON_SMALL,
(LPARAM)hIcon);
return TRUE;
}
@ -340,10 +344,10 @@ CreateDialogProc(HWND hDlg,
{
PCREATE_DATA Data;
Data = (PCREATE_DATA) HeapAlloc(ProcessHeap,
HEAP_ZERO_MEMORY,
sizeof(CREATE_DATA));
if (Data != NULL)
Data = (PCREATE_DATA)HeapAlloc(ProcessHeap,
HEAP_ZERO_MEMORY,
sizeof(CREATE_DATA));
if (Data)
{
Data->hSelf = hDlg;
@ -362,7 +366,6 @@ CreateDialogProc(HWND hDlg,
FreeMemory(Data);
}
DestroyIcon(hIcon);
EndDialog(hDlg,
LOWORD(wParam));
return TRUE;
@ -370,7 +373,6 @@ CreateDialogProc(HWND hDlg,
case IDCANCEL:
{
DestroyIcon(hIcon);
EndDialog(hDlg,
LOWORD(wParam));
return TRUE;

View file

@ -119,8 +119,11 @@ DeleteDialogProc(HWND hDlg,
case IDOK:
{
if (DoDeleteService(Info, hDlg))
{
(void)ListView_DeleteItem(Info->hListView,
Info->SelectedItem);
UpdateServiceCount(Info);
}
EndDialog(hDlg,
LOWORD(wParam));
return TRUE;

View file

@ -231,8 +231,6 @@ RefreshServiceList(PMAIN_WND_INFO Info)
ENUM_SERVICE_STATUS_PROCESS *pService;
LPTSTR lpDescription;
LVITEM lvItem;
LPTSTR lpNumServices;
TCHAR szNumServices[32];
TCHAR szStatus[64];
DWORD NumServices;
DWORD Index;
@ -241,8 +239,6 @@ RefreshServiceList(PMAIN_WND_INFO Info)
if (GetServiceList(Info, &NumServices))
{
INT NumListedServ = 0;
for (Index = 0; Index < NumServices; Index++)
{
LPQUERY_SERVICE_CONFIG pServiceConfig;
@ -334,26 +330,7 @@ RefreshServiceList(PMAIN_WND_INFO Info)
}
}
if (AllocAndLoadString(&lpNumServices,
hInstance,
IDS_NUM_SERVICES))
{
NumListedServ = ListView_GetItemCount(Info->hListView);
_sntprintf(szNumServices,
31,
lpNumServices,
NumListedServ);
SendMessage(Info->hStatus,
SB_SETTEXT,
0,
(LPARAM)szNumServices);
HeapFree(ProcessHeap,
0,
lpNumServices);
}
UpdateServiceCount(Info);
}
/* turn redraw flag on. It's turned off initially via the LBS_NOREDRAW flag */

View file

@ -121,6 +121,35 @@ UpdateMainStatusBar(PMAIN_WND_INFO Info)
}
}
VOID
UpdateServiceCount(PMAIN_WND_INFO Info)
{
LPTSTR lpNumServices;
if (AllocAndLoadString(&lpNumServices,
hInstance,
IDS_NUM_SERVICES))
{
TCHAR szNumServices[32];
INT NumListedServ = ListView_GetItemCount(Info->hListView);
_sntprintf(szNumServices,
31,
lpNumServices,
NumListedServ);
SendMessage(Info->hStatus,
SB_SETTEXT,
0,
(LPARAM)szNumServices);
HeapFree(ProcessHeap,
0,
lpNumServices);
}
}
VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
{

View file

@ -60,6 +60,7 @@ typedef struct _MENU_HINT
UINT HintId;
} MENU_HINT, *PMENU_HINT;
VOID UpdateServiceCount(PMAIN_WND_INFO Info);
VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS* pService, UINT Column);
BOOL InitMainWindowImpl(VOID);
VOID UninitMainWindowImpl(VOID);