Author: gedmurphy
Date: Thu Aug 30 17:39:59 2007
New Revision: 28671
URL:
http://svn.reactos.org/svn/reactos?rev=28671&view=rev
Log:
update the visual service count when a service is deleted
Modified:
trunk/reactos/base/applications/mscutils/servman/create.c
trunk/reactos/base/applications/mscutils/servman/delete.c
trunk/reactos/base/applications/mscutils/servman/listview.c
trunk/reactos/base/applications/mscutils/servman/mainwnd.c
trunk/reactos/base/applications/mscutils/servman/precomp.h
Modified: trunk/reactos/base/applications/mscutils/servman/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/create.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/create.c Thu Aug 30 17:39:59 2007
@@ -318,17 +318,21 @@
{
case WM_INITDIALOG:
{
- hIcon = (HICON) LoadImage(hInstance,
- MAKEINTRESOURCE(IDI_SM_ICON),
- IMAGE_ICON,
- 16,
- 16,
- 0);
-
- SendMessage(hDlg,
- WM_SETICON,
- ICON_SMALL,
- (LPARAM)hIcon);
+ 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);
+ }
+
return TRUE;
}
@@ -340,10 +344,10 @@
{
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 @@
FreeMemory(Data);
}
- DestroyIcon(hIcon);
EndDialog(hDlg,
LOWORD(wParam));
return TRUE;
@@ -370,7 +373,6 @@
case IDCANCEL:
{
- DestroyIcon(hIcon);
EndDialog(hDlg,
LOWORD(wParam));
return TRUE;
Modified: trunk/reactos/base/applications/mscutils/servman/delete.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/delete.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/delete.c Thu Aug 30 17:39:59 2007
@@ -119,8 +119,11 @@
case IDOK:
{
if (DoDeleteService(Info, hDlg))
+ {
(void)ListView_DeleteItem(Info->hListView,
Info->SelectedItem);
+ UpdateServiceCount(Info);
+ }
EndDialog(hDlg,
LOWORD(wParam));
return TRUE;
Modified: trunk/reactos/base/applications/mscutils/servman/listview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/listview.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/listview.c Thu Aug 30 17:39:59 2007
@@ -231,8 +231,6 @@
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 @@
if (GetServiceList(Info, &NumServices))
{
- INT NumListedServ = 0;
-
for (Index = 0; Index < NumServices; Index++)
{
LPQUERY_SERVICE_CONFIG pServiceConfig;
@@ -334,26 +330,7 @@
}
}
- 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 */
Modified: trunk/reactos/base/applications/mscutils/servman/mainwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/mainwnd.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/mainwnd.c Thu Aug 30 17:39:59 2007
@@ -118,6 +118,35 @@
SB_SIMPLE,
(WPARAM)Info->bInMenuLoop,
0);
+ }
+}
+
+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);
}
}
Modified: trunk/reactos/base/applications/mscutils/servman/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/precomp.h (original)
+++ trunk/reactos/base/applications/mscutils/servman/precomp.h Thu Aug 30 17:39:59 2007
@@ -60,6 +60,7 @@
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);