From 43df1080f800ed412a2e626456dc3794438abf8c Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Sun, 8 Jan 2006 23:24:43 +0000 Subject: [PATCH] implement list refreshing and program exit svn path=/trunk/; revision=20741 --- reactos/subsys/system/servman/En.rc | 18 ++++---- reactos/subsys/system/servman/query.c | 2 + reactos/subsys/system/servman/resource.h | 1 - reactos/subsys/system/servman/servman.c | 53 +++++++++++++----------- 4 files changed, 40 insertions(+), 34 deletions(-) diff --git a/reactos/subsys/system/servman/En.rc b/reactos/subsys/system/servman/En.rc index 6c54d93969c..da6fd91e28d 100644 --- a/reactos/subsys/system/servman/En.rc +++ b/reactos/subsys/system/servman/En.rc @@ -3,7 +3,7 @@ IDR_MAINMENU MENU BEGIN POPUP "&File" BEGIN - MENUITEM "E&xit",ID_FILE_EXIT + MENUITEM "E&xit",ID_EXIT END POPUP "Action" BEGIN @@ -71,22 +71,22 @@ IDB_BUTTONS BITMAP "res/toolbar.bmp" STRINGTABLE DISCARDABLE BEGIN - IDS_FIRSTCOLUMN "Name" + IDS_FIRSTCOLUMN "Name" IDS_SECONDCOLUMN "Description" - IDS_THIRDCOLUMN "Status" + IDS_THIRDCOLUMN "Status" IDS_FOURTHCOLUMN "Startup Type" - IDS_FITHCOLUMN "Log On As" + IDS_FITHCOLUMN "Log On As" END STRINGTABLE DISCARDABLE BEGIN IDS_SERVICES_STATUS_RUNNING "Started" IDS_SERVICES_STATUS_STOPPED "Stopped" - IDS_SERVICES_YES "Yes" - IDS_SERVICES_UNKNOWN "Unknown" - IDS_SERVICES_AUTO "Automatic" - IDS_SERVICES_MAN "Manual" - IDS_SERVICES_DIS "Disabled" + IDS_SERVICES_YES "Yes" + IDS_SERVICES_UNKNOWN "Unknown" + IDS_SERVICES_AUTO "Automatic" + IDS_SERVICES_MAN "Manual" + IDS_SERVICES_DIS "Disabled" END STRINGTABLE DISCARDABLE diff --git a/reactos/subsys/system/servman/query.c b/reactos/subsys/system/servman/query.c index c78582deb07..1d83b348a1e 100644 --- a/reactos/subsys/system/servman/query.c +++ b/reactos/subsys/system/servman/query.c @@ -34,6 +34,8 @@ RefreshServiceList(VOID) DWORD Index; LPCTSTR Path = _T("System\\CurrentControlSet\\Services\\%s"); + ListView_DeleteAllItems(hListView); + NumServices = GetServiceList(); if (NumServices) diff --git a/reactos/subsys/system/servman/resource.h b/reactos/subsys/system/servman/resource.h index ac77ec9c8f7..71b3e9a9367 100644 --- a/reactos/subsys/system/servman/resource.h +++ b/reactos/subsys/system/servman/resource.h @@ -22,7 +22,6 @@ #define ID_EXIT 2010 #define IDR_MAINMENU 102 -#define ID_FILE_EXIT 4001 #define ID_VIEW_CUSTOMIZE 4021 #define ID_HELP_ABOUT 4031 diff --git a/reactos/subsys/system/servman/servman.c b/reactos/subsys/system/servman/servman.c index 49ffa6044cb..1e30eab5574 100644 --- a/reactos/subsys/system/servman/servman.c +++ b/reactos/subsys/system/servman/servman.c @@ -26,30 +26,28 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { //HFONT hfDefault; - HWND hTool; TBADDBITMAP tbab; INT iImageOffset; - INT statwidths[] = {110, -1}; + INT statwidths[] = {110, -1}; /* widths of status bar */ TCHAR szTemp[256]; - RECT rcClient; LVCOLUMN lvc = { 0 }; /* Toolbar buttons */ TBBUTTON tbb [NUM_BUTTONS] = - { // iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString + { /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */ {TBICON_PROP, ID_PROP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* properties */ {TBICON_REFRESH, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* refresh */ {TBICON_EXPORT, ID_EXPORT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* export */ /* Note: First item for a seperator is its width in pixels */ - {5, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ + {25, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ {TBICON_START, ID_START, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* start */ {TBICON_STOP, ID_STOP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* stop */ {TBICON_PAUSE, ID_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* pause */ {TBICON_RESTART, ID_RESTART, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* restart */ - {5, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ + {25, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ {TBICON_NEW, ID_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* start */ {TBICON_HELP, ID_HELP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* stop */ @@ -98,10 +96,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Add buttons to toolbar */ SendMessage(hTool, TB_ADDBUTTONS, NUM_BUTTONS, (LPARAM) &tbb); - /* Send a WM_SIZE message to layout controls */ - GetClientRect(hwnd, &rcClient); - SendMessage(hwnd, WM_SIZE, SIZE_RESTORED, MAKELONG(rcClient.right, rcClient.bottom)); - /* Show toolbar */ ShowWindow(hTool, SW_SHOWNORMAL); @@ -121,39 +115,43 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (hListView == NULL) MessageBox(hwnd, _T("Could not create List View."), _T("Error"), MB_OK | MB_ICONERROR); - - ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT | - /*LVS_EX_GRIDLINES |*/ LVS_EX_HEADERDRAGDROP); + LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP); lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH | LVCF_FMT; lvc.fmt = LVCFMT_LEFT; - /* Add columns to the list-view (first column contains check box). */ + /* Add columns to the list-view */ + + /* name */ lvc.iSubItem = 0; lvc.cx = 160; LoadString(hInstance, IDS_FIRSTCOLUMN, szTemp, 256); lvc.pszText = szTemp; ListView_InsertColumn(hListView, 0, &lvc); + /* description */ lvc.iSubItem = 1; lvc.cx = 260; LoadString(hInstance, IDS_SECONDCOLUMN, szTemp, 256); lvc.pszText = szTemp; ListView_InsertColumn(hListView, 1, &lvc); + /* status */ lvc.iSubItem = 2; lvc.cx = 75; LoadString(hInstance, IDS_THIRDCOLUMN, szTemp, 256); lvc.pszText = szTemp; ListView_InsertColumn(hListView, 2, &lvc); + /* startup type */ lvc.iSubItem = 3; lvc.cx = 80; LoadString(hInstance, IDS_FOURTHCOLUMN, szTemp, 256); lvc.pszText = szTemp; ListView_InsertColumn(hListView, 3, &lvc); + /* logon as */ lvc.iSubItem = 4; lvc.cx = 100; LoadString(hInstance, IDS_FITHCOLUMN, szTemp, 256); @@ -309,11 +307,18 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch(LOWORD(wParam)) { - case ID_FILE_EXIT: - PostMessage(hwnd, WM_CLOSE, 0, 0); - break; + case ID_PROP: + PropSheets(hwnd); + break; + + case ID_REFRESH: + if (! RefreshServiceList() ) + GetError(); + + case ID_EXPORT: + break; - case ID_START: + case ID_START: break; case ID_STOP: @@ -328,13 +333,16 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case ID_RESTART: break; - case ID_REFRESH: + case ID_NEW: break; - case ID_PROP: - PropSheets(hwnd); + case ID_HELP: break; + case ID_EXIT: + PostMessage(hwnd, WM_CLOSE, 0, 0); + break; + case ID_VIEW_CUSTOMIZE: break; @@ -345,9 +353,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) AboutDialogProc); break; - case ID_EXPORT: - break; - } break; -- 2.17.1