Author: gedmurphy Date: Thu Oct 11 15:09:39 2007 New Revision: 29500
URL: http://svn.reactos.org/svn/reactos?rev=29500&view=rev Log: improve the button states in relation to the service
Modified: trunk/reactos/base/applications/mscutils/servman/mainwnd.c trunk/reactos/base/applications/mscutils/servman/precomp.h trunk/reactos/base/applications/mscutils/servman/propsheet.c
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 Oct 11 15:09:39 2007 @@ -151,7 +151,6 @@
VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info) { - LPQUERY_SERVICE_CONFIG lpServiceConfig; HMENU hMainMenu; UINT i;
@@ -169,6 +168,9 @@
if (Info->SelectedItem != NO_ITEM_SELECTED) { + LPQUERY_SERVICE_CONFIG lpServiceConfig = NULL; + DWORD Flags, State; + /* allow user to delete service */ if (Info->bIsUserAnAdmin) { @@ -178,14 +180,13 @@ EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_ENABLED); }
+ Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted; + State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState; + lpServiceConfig = GetServiceConfig(Info->pCurrentService->lpServiceName); + if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED) { - DWORD Flags, State; - - Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted; - State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState; - if (State == SERVICE_STOPPED) { EnableMenuItem(hMainMenu, ID_START, MF_ENABLED); @@ -193,23 +194,7 @@ SendMessage(Info->hTool, TB_SETSTATE, ID_START, (LPARAM)MAKELONG(TBSTATE_ENABLED, 0)); } - - if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) ) - { - EnableMenuItem(hMainMenu, ID_STOP, MF_ENABLED); - EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_STOP, MF_ENABLED); - SendMessage(Info->hTool, TB_SETSTATE, ID_STOP, - (LPARAM)MAKELONG(TBSTATE_ENABLED, 0)); - } - - if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) ) - { - EnableMenuItem(hMainMenu, ID_PAUSE, MF_ENABLED); - EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PAUSE, MF_ENABLED); - SendMessage(Info->hTool, TB_SETSTATE, ID_PAUSE, - (LPARAM)MAKELONG(TBSTATE_ENABLED, 0)); - } - + if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) ) { EnableMenuItem(hMainMenu, ID_RESTART, MF_ENABLED); @@ -219,6 +204,22 @@ }
HeapFree(GetProcessHeap(), 0, lpServiceConfig); + } + + if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) ) + { + EnableMenuItem(hMainMenu, ID_STOP, MF_ENABLED); + EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_STOP, MF_ENABLED); + SendMessage(Info->hTool, TB_SETSTATE, ID_STOP, + (LPARAM)MAKELONG(TBSTATE_ENABLED, 0)); + } + + if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) ) + { + EnableMenuItem(hMainMenu, ID_PAUSE, MF_ENABLED); + EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PAUSE, MF_ENABLED); + SendMessage(Info->hTool, TB_SETSTATE, ID_PAUSE, + (LPARAM)MAKELONG(TBSTATE_ENABLED, 0)); } } else @@ -396,6 +397,7 @@ Info->bDlgOpen = TRUE; OpenPropSheet(Info); Info->bDlgOpen = FALSE; + SetMenuAndButtonStates(Info); } } break;
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 Oct 11 15:09:39 2007 @@ -60,6 +60,7 @@ UINT HintId; } MENU_HINT, *PMENU_HINT;
+VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info); VOID UpdateServiceCount(PMAIN_WND_INFO Info); VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS* pService, UINT Column); BOOL InitMainWindowImpl(VOID);
Modified: trunk/reactos/base/applications/mscutils/servman/propsheet.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/... ============================================================================== --- trunk/reactos/base/applications/mscutils/servman/propsheet.c (original) +++ trunk/reactos/base/applications/mscutils/servman/propsheet.c Thu Oct 11 15:09:39 2007 @@ -35,26 +35,26 @@ }
lpServiceConfig = GetServiceConfig(dlgInfo->pService->lpServiceName); - if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED) - { - if (State == SERVICE_STOPPED) - { - hButton = GetDlgItem(hwndDlg, IDC_START); - EnableWindow (hButton, TRUE); - } - else if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) ) - { - hButton = GetDlgItem(hwndDlg, IDC_STOP); - EnableWindow (hButton, TRUE); - } - else if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) ) - { - hButton = GetDlgItem(hwndDlg, IDC_PAUSE); - EnableWindow (hButton, TRUE); - } - + if (State == SERVICE_STOPPED && + lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED) + { + hButton = GetDlgItem(hwndDlg, IDC_START); + EnableWindow (hButton, TRUE); HeapFree(GetProcessHeap(), 0, lpServiceConfig); } + else if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) ) + { + hButton = GetDlgItem(hwndDlg, IDC_STOP); + EnableWindow (hButton, TRUE); + } + else if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) ) + { + hButton = GetDlgItem(hwndDlg, IDC_PAUSE); + EnableWindow (hButton, TRUE); + } + + /* set the main toolbar */ + SetMenuAndButtonStates(dlgInfo->Info); }
@@ -365,6 +365,7 @@ { case PSN_APPLY: SaveDlgInfo(dlgInfo, hwndDlg); + SetButtonStates(dlgInfo, hwndDlg); break; } }