use ChangeListViewText to fill out the service info

svn path=/trunk/; revision=29502
This commit is contained in:
Ged Murphy 2007-10-11 12:21:06 +00:00
parent 8c49001628
commit 07ed4d1ce3

View file

@ -229,9 +229,7 @@ BOOL
RefreshServiceList(PMAIN_WND_INFO Info)
{
ENUM_SERVICE_STATUS_PROCESS *pService;
LPTSTR lpDescription;
LVITEM lvItem;
TCHAR szStatus[64];
DWORD NumServices;
DWORD Index;
@ -246,7 +244,7 @@ RefreshServiceList(PMAIN_WND_INFO Info)
{
for (Index = 0; Index < NumServices; Index++)
{
LPQUERY_SERVICE_CONFIG pServiceConfig;
INT i;
pService = &Info->pAllServices[Index];
@ -261,75 +259,10 @@ RefreshServiceList(PMAIN_WND_INFO Info)
/* add it to the listview */
lvItem.iItem = ListView_InsertItem(Info->hListView, &lvItem);
/* set the description */
if ((lpDescription = GetServiceDescription(pService->lpServiceName)))
/* fill out all the column data */
for (i = LVDESC; i <= LVLOGONAS; i++)
{
lvItem.pszText = lpDescription;
lvItem.iSubItem = LVDESC;
SendMessage(Info->hListView,
LVM_SETITEMTEXT,
lvItem.iItem,
(LPARAM)&lvItem);
HeapFree(ProcessHeap,
0,
lpDescription);
}
/* set the status */
if (pService->ServiceStatusProcess.dwCurrentState == SERVICE_RUNNING)
{
LoadString(hInstance,
IDS_SERVICES_STARTED,
szStatus,
sizeof(szStatus) / sizeof(TCHAR));
lvItem.pszText = szStatus;
lvItem.iSubItem = LVSTATUS;
SendMessage(Info->hListView,
LVM_SETITEMTEXT,
lvItem.iItem,
(LPARAM)&lvItem);
}
pServiceConfig = GetServiceConfig(pService->lpServiceName);
if (pServiceConfig)
{
DWORD StringId = 0;
LPTSTR lpStartup;
/* set the startup type */
switch (pServiceConfig->dwStartType)
{
case 2: StringId = IDS_SERVICES_AUTO; break;
case 3: StringId = IDS_SERVICES_MAN; break;
case 4: StringId = IDS_SERVICES_DIS; break;
}
if (StringId)
AllocAndLoadString(&lpStartup,
hInstance,
StringId);
lvItem.pszText = lpStartup;
lvItem.iSubItem = LVSTARTUP;
SendMessage(Info->hListView,
LVM_SETITEMTEXT,
lvItem.iItem,
(LPARAM)&lvItem);
LocalFree(lpStartup);
/* set Log On As */
lvItem.pszText = pServiceConfig->lpServiceStartName;
lvItem.iSubItem = LVLOGONAS;
SendMessage(Info->hListView,
LVM_SETITEMTEXT,
lvItem.iItem,
(LPARAM)&lvItem);
HeapFree(ProcessHeap,
0,
pServiceConfig);
ChangeListViewText(Info, pService, i);
}
}