- add functionality to delete current services - allow setting of a description when creating services - turn off toolbar buttons and menu items when not usable - fix the toolbar icons so they don't look weird when greyed out - a few other random bugfixes and alterations. Modified: trunk/reactos/base/system/servman/En.rc Modified: trunk/reactos/base/system/servman/create.c Added: trunk/reactos/base/system/servman/delete.c Modified: trunk/reactos/base/system/servman/propsheet.c Modified: trunk/reactos/base/system/servman/query.c Modified: trunk/reactos/base/system/servman/res/toolbar.bmp Modified: trunk/reactos/base/system/servman/resource.h Modified: trunk/reactos/base/system/servman/servman.c Modified: trunk/reactos/base/system/servman/servman.h Modified: trunk/reactos/base/system/servman/servman.rbuild _____
Modified: trunk/reactos/base/system/servman/En.rc --- trunk/reactos/base/system/servman/En.rc 2006-02-03 17:36:44 UTC (rev 73) +++ trunk/reactos/base/system/servman/En.rc 2006-02-03 18:19:53 UTC (rev 74) @@ -2,10 +2,14 @@
BEGIN POPUP "&File" BEGIN + MENUITEM "Export...", ID_EXPORT + MENUITEM SEPARATOR MENUITEM "E&xit", ID_EXIT END POPUP "Action" BEGIN + MENUITEM "Connect to...", ID_NET_CON, GRAYED + MENUITEM SEPARATOR MENUITEM "Start", ID_START, GRAYED MENUITEM "Stop", ID_STOP, GRAYED MENUITEM "Pause", ID_PAUSE, GRAYED @@ -14,7 +18,11 @@ MENUITEM SEPARATOR MENUITEM "Refresh", ID_REFRESH MENUITEM SEPARATOR - MENUITEM "Properties", ID_PROP, GRAYED + MENUITEM "Edit...", ID_EDIT, GRAYED + MENUITEM "Create...", ID_CREATE + MENUITEM "Delete...", ID_DELETE, GRAYED + MENUITEM SEPARATOR + MENUITEM "Properties...", ID_PROP, GRAYED END POPUP "View" BEGIN @@ -23,11 +31,11 @@ MENUITEM "List", ID_VIEW_LIST MENUITEM "Details", ID_VIEW_DETAILS MENUITEM SEPARATOR - MENUITEM "Customize", ID_VIEW_CUSTOMIZE, GRAYED + MENUITEM "Customize...",ID_VIEW_CUSTOMIZE, GRAYED END POPUP "Help" BEGIN - MENUITEM "About", ID_ABOUT + MENUITEM "About...", ID_ABOUT END END IDR_POPUP MENU @@ -40,21 +48,14 @@ MENUITEM "Resume", ID_RESUME, GRAYED MENUITEM "Restart", ID_RESTART, GRAYED MENUITEM SEPARATOR - POPUP "All tasks" - BEGIN - MENUITEM "Start", ID_START, GRAYED - MENUITEM "Stop", ID_STOP, GRAYED - MENUITEM "Pause", ID_PAUSE, GRAYED - MENUITEM "Resume", ID_RESUME, GRAYED - MENUITEM "Restart", ID_RESTART, GRAYED - MENUITEM "Refresh", ID_REFRESH, GRAYED - END - MENUITEM SEPARATOR MENUITEM "Refresh", ID_REFRESH MENUITEM SEPARATOR - MENUITEM "Properties", ID_PROP + MENUITEM "Edit...", ID_EDIT, GRAYED + MENUITEM "Delete...", ID_DELETE, GRAYED MENUITEM SEPARATOR - MENUITEM "Help", ID_HELP + MENUITEM "Properties...", ID_PROP, GRAYED + MENUITEM SEPARATOR + MENUITEM "Help...", ID_HELP END END
@@ -127,6 +128,20 @@ CONTROL "Help",ID_CREATE_HELP,"Button",0x50010000,6,192,44,13 END
+IDD_DLG_DELETE DIALOGEX 6,6,185,148 +CAPTION "Delete a service" +FONT 8,"Tahoma",0,0 +STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + ICON IDI_WARNING, IDC_STATIC, 4, 5, 24, 22 + LTEXT "Are you sure you want to delete the following service? This cannot be undone once removed!", IDC_STATIC, 32, 9, 152, 17 + LTEXT "Service Name:",IDC_STATIC, 6, 40, 80, 9 + LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15 + EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY + PUSHBUTTON "Yes", IDOK, 26, 129, 54, 13 + PUSHBUTTON "No", IDCANCEL, 102, 129, 54, 13 +END + IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150 CAPTION "Options" FONT 8,"MS Sans Serif",0,0 @@ -143,8 +158,8 @@ EXSTYLE WS_EX_TOOLWINDOW BEGIN CONTROL "",IDC_SERVCON_PROGRESS,"msctls_progress32",0x50000000,8,46,238,13 - CONTROL "",IDC_SERVCON_INFO,"Static",0x50000000,8,5,236,11 - CONTROL "",IDC_SERVCON_NAME,"Static",0x50000000,8,25,66,11 + LTEXT "", IDC_SERVCON_INFO, 8, 5, 236, 11 + LTEXT "", IDC_SERVCON_NAME, 8, 25, 66, 11 PUSHBUTTON "&Close", IDOK, 100, 70, 54, 13 END
_____
Modified: trunk/reactos/base/system/servman/create.c --- trunk/reactos/base/system/servman/create.c 2006-02-03 17:36:44 UTC (rev 73) +++ trunk/reactos/base/system/servman/create.c 2006-02-03 18:19:53 UTC (rev 74) @@ -3,7 +3,7 @@
* LICENSE: GPL - See COPYING in the top level directory * FILE: base/system/servman/create.c * PURPOSE: Create a new service - * COPYRIGHT: Copyright 2005 Ged Murphy gedmurphy@gmail.com + * COPYRIGHT: Copyright 2006 Ged Murphy gedmurphy@gmail.com * */
@@ -20,6 +20,9 @@ { SC_HANDLE hSCManager; SC_HANDLE hSc; + HKEY hKey; + LPCTSTR Path = _T("System\CurrentControlSet\Services\%s"); + TCHAR buf[300];
/* open handle to the SCM */ hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); @@ -49,6 +52,19 @@ return FALSE; }
+ + + /* open the registry key for the service */ + /* TODO: move all this into query */ + _sntprintf(buf, sizeof(buf) / sizeof(TCHAR), Path, ServiceName); + RegOpenKeyEx(HKEY_LOCAL_MACHINE, + buf, + 0, + KEY_READ, + &hKey); + + SetDescription(hKey, &Description); + DisplayString(_T("Service Succesfully Created")); CloseServiceHandle(hSCManager); CloseServiceHandle(hSc); _____
Added: trunk/reactos/base/system/servman/delete.c --- trunk/reactos/base/system/servman/delete.c 2006-02-03 17:36:44 UTC (rev 73) +++ trunk/reactos/base/system/servman/delete.c 2006-02-03 18:19:53 UTC (rev 74) @@ -0,0 +1,108 @@
+/* + * PROJECT: ReactOS Services + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/servman/delete.c + * PURPOSE: Delete an existing service + * COPYRIGHT: Copyright 2006 Ged Murphy gedmurphy@gmail.com + * + */ + +#include "servman.h" + +extern HINSTANCE hInstance; +extern HWND hListView; + +BOOL DoDeleteService(HWND hDlg) +{ + SC_HANDLE hSCManager; + SC_HANDLE hSc; + ENUM_SERVICE_STATUS_PROCESS *Service = NULL; + + /* open handle to the SCM */ + hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (hSCManager == NULL) + { + GetError(0); + return FALSE; + } + + /* copy pointer to selected service */ + Service = GetSelectedService(); + + /* get a handle to the service requested for starting */ + hSc = OpenService(hSCManager, Service->lpServiceName, DELETE); + if (hSc == NULL) + { + GetError(0); + return FALSE; + } + + /* start the service opened */ + if (! DeleteService(hSc)) + { + GetError(0); + return FALSE; + } + + + CloseServiceHandle(hSCManager); + CloseServiceHandle(hSc); + + return TRUE; +} + + +#ifdef _MSC_VER +#pragma warning(disable : 4100) +#endif +BOOL CALLBACK +DeleteDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + ENUM_SERVICE_STATUS_PROCESS *Service = NULL; + HICON hIcon = NULL; + TCHAR Buf[1000]; + LVITEM item; + + switch (message) + { + case WM_INITDIALOG: + + hIcon = LoadImage(hInstance, MAKEINTRESOURCE(IDI_SM_ICON), IMAGE_ICON, 16, 16, 0); + SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); + + /* get pointer to selected service */ + Service = GetSelectedService(); + + SendDlgItemMessage(hDlg, IDC_DEL_NAME, WM_SETTEXT, 0, (LPARAM)Service->lpDisplayName); + + + item.mask = LVIF_TEXT; + item.iItem = GetSelectedItem(); + item.iSubItem = 1; + item.pszText = Buf; + item.cchTextMax = sizeof(Buf); + SendMessage(hListView, LVM_GETITEM, 0, (LPARAM)&item); + + SendDlgItemMessage(hDlg, IDC_DEL_DESC, WM_SETTEXT, 0, + (LPARAM)Buf); + + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: + DoDeleteService(hDlg); + DestroyIcon(hIcon); + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + + case IDCANCEL: + DestroyIcon(hIcon); + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + } + } + + return FALSE; +} _____
Modified: trunk/reactos/base/system/servman/propsheet.c --- trunk/reactos/base/system/servman/propsheet.c 2006-02-03 17:36:44 UTC (rev 73) +++ trunk/reactos/base/system/servman/propsheet.c 2006-02-03 18:19:53 UTC (rev 74) @@ -124,6 +124,7 @@
Service = GetSelectedService();
/* open the registry key for the service */ + /* TODO: move all this into query (getdescription)*/ _sntprintf(buf, sizeof(buf) / sizeof(TCHAR), Path, Service->lpServiceName); RegOpenKeyEx(HKEY_LOCAL_MACHINE, buf, @@ -309,6 +310,37 @@ }
+INT CALLBACK AddEditButton(HWND hwnd, UINT message, LPARAM lParam) +{ + HWND hEditButton; + + switch (message) + { + case PSCB_PRECREATE: + /*hEditButton = CreateWindowEx(0, + WC_BUTTON, + NULL, + WS_CHILD | WS_VISIBLE, + 20, 300, 30, 15, + hwnd, + NULL, + hInstance, + NULL); + if (hEditButton == NULL) + GetError(0);*/ + + hEditButton = GetDlgItem(hwnd, PSBTN_OK); + DestroyWindow(hEditButton); + //SetWindowText(hEditButton, _T("test")); + + return TRUE; + } + return TRUE; +} + + + + static VOID InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc) { @@ -324,29 +356,30 @@ LONG APIENTRY OpenPropSheet(HWND hwnd) { - PROPSHEETHEADER psh; - PROPSHEETPAGE psp[2]; - TCHAR Caption[256]; + PROPSHEETHEADER psh; + PROPSHEETPAGE psp[2]; + ENUM_SERVICE_STATUS_PROCESS *Service = NULL;
- LoadString(hInstance, IDS_PROP_SHEET, Caption, sizeof(Caption) / sizeof(TCHAR)); + Service = GetSelectedService();
- ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); - psh.dwSize = sizeof(PROPSHEETHEADER); - psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE; - psh.hwndParent = NULL; - psh.hInstance = hInstance; - psh.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SM_ICON)); - psh.pszCaption = Caption; - psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); - psh.nStartPage = 0; - psh.ppsp = psp; + ZeroMemory(&psh, sizeof(PROPSHEETHEADER)); + psh.dwSize = sizeof(PROPSHEETHEADER); + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USECALLBACK; + psh.hwndParent = hwnd; + psh.hInstance = hInstance; + psh.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SM_ICON)); + psh.pszCaption = Service->lpDisplayName; + psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE); + psh.nStartPage = 0; + psh.pfnCallback = AddEditButton; + psh.ppsp = psp;
- InitPropSheetPage(&psp[0], IDD_DLG_GENERAL, GeneralPageProc); - //InitPropSheetPage(&psp[1], IDD_DLG_GENERAL, LogonPageProc); - //InitPropSheetPage(&psp[2], IDD_DLG_GENERAL, RecoveryPageProc); - InitPropSheetPage(&psp[1], IDD_DLG_DEPEND, DependanciesPageProc);
+ InitPropSheetPage(&psp[0], IDD_DLG_GENERAL, GeneralPageProc); + //InitPropSheetPage(&psp[1], IDD_DLG_GENERAL, LogonPageProc); + //InitPropSheetPage(&psp[2], IDD_DLG_GENERAL, RecoveryPageProc); + InitPropSheetPage(&psp[1], IDD_DLG_DEPEND, DependanciesPageProc);
- return (LONG)(PropertySheet(&psh) != -1); + return (LONG)(PropertySheet(&psh) != -1); }
_____
Modified: trunk/reactos/base/system/servman/query.c --- trunk/reactos/base/system/servman/query.c 2006-02-03 17:36:44 UTC (rev 73) +++ trunk/reactos/base/system/servman/query.c 2006-02-03 18:19:53 UTC (rev 74) @@ -42,6 +42,24 @@
}
+/* Sets the service description in the registry */ +BOOL SetDescription(HKEY hKey, LPTSTR *Description) +{ + TCHAR szBuf[MAX_PATH]; + + if (RegSetValueEx(hKey, + L"Description", + 0, + REG_SZ, + (LPBYTE)Description, + (DWORD)lstrlen(szBuf)+1)) + GetError(0); + + + RegCloseKey(hKey); + return TRUE; +} + /* Retrives the service description from the registry */ BOOL GetDescription(HKEY hKey, LPTSTR *retDescription) { @@ -176,22 +194,30 @@
if (NumServices) { - HICON hiconItem; /* icon for list-view items */ - HIMAGELIST hSmall; /* image list for other views */ + HICON hiconItem, hiconItem2; /* icon for list-view items */ + HIMAGELIST hSmall, hLarge; /* image list for other views */ TCHAR buf[300]; /* buffer to hold key path */ INT NumListedServ = 0; /* how many services were listed */
/* Create the icon image lists */ hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON), - GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR16, 1, 1); + GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, 1, 1);
+ hLarge = ImageList_Create(GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, 1, 1); + /* Add an icon to each image list */ hiconItem = LoadImage(hInstance, MAKEINTRESOURCE(IDI_SM_ICON), IMAGE_ICON, 16, 16, 0); ImageList_AddIcon(hSmall, hiconItem);
+ hiconItem2 = LoadImage(hInstance, MAKEINTRESOURCE(IDI_SM_ICON), + IMAGE_ICON, 48, 48, 0); + ImageList_AddIcon(hLarge, hiconItem2); + /* assign the image to the list view */ ListView_SetImageList(hListView, hSmall, LVSIL_SMALL); + ListView_SetImageList(hListView, hLarge, LVSIL_NORMAL);
for (Index = 0; Index < NumServices; Index++) { _____
Modified: trunk/reactos/base/system/servman/res/toolbar.bmp (Binary files differ) _____
Modified: trunk/reactos/base/system/servman/resource.h --- trunk/reactos/base/system/servman/resource.h 2006-02-03 17:36:44 UTC (rev 73) +++ trunk/reactos/base/system/servman/resource.h 2006-02-03 18:19:53 UTC (rev 74) @@ -8,6 +8,7 @@
#define IDC_SERVLIST 1000 #define IDC_TOOLBAR 1001 #define IDC_STATUSBAR 1002 +#define IDC_EDIT_BUTTON 1003
#define ID_PROP 2000 #define ID_REFRESH 2001 @@ -17,9 +18,12 @@ #define ID_PAUSE 2005 #define ID_RESUME 2006 #define ID_RESTART 2007 -#define ID_NEW 2008 -#define ID_HELP 2009 -#define ID_EXIT 2010 +#define ID_EDIT 2008 +#define ID_CREATE 2009 +#define ID_DELETE 2010 +#define ID_HELP 2011 +#define ID_EXIT 2012 +#define ID_NET_CON 2013
#define IDR_MAINMENU 102 #define IDR_POPUP 103 @@ -63,7 +67,7 @@ #define TBICON_PROP 0 #define TBICON_REFRESH 1 #define TBICON_EXPORT 2 -#define TBICON_NEW 3 +#define TBICON_CREATE 3 #define TBICON_START 4 #define TBICON_STOP 5 #define TBICON_PAUSE 6 @@ -72,7 +76,6 @@ #define TBICON_EXIT 9
/* properties dialog */ -#define IDS_PROP_SHEET 10000 #define IDD_DLG_GENERAL 10001 #define IDC_SERV_NAME 10041 #define IDC_DISP_NAME 10051 @@ -86,6 +89,7 @@ #define IDC_RESUME 10161 #define IDC_START_PARAM 10191
+/* dependancies dialog */ #define IDD_DLG_DEPEND 20001 #define IDC_DEPEND_TREE1 20002 #define IDC_DEPEND_TREE2 20003 @@ -104,6 +108,14 @@ #define IDC_CREATE_HELP 8021 #define IDS_HELP_OPTIONS 8022
+ +/* delete service dialog */ +#define IDD_DLG_DELETE 9000 +#define IDC_DEL_GROUP 9001 +#define IDC_DEL_NAME 9002 +#define IDC_DEL_DESC 9003 + + /* progress bar */ #define IDD_DLG_PROGRESS 7000 #define IDC_SERVCON_PROGRESS 7001 _____
Modified: trunk/reactos/base/system/servman/servman.c --- trunk/reactos/base/system/servman/servman.c 2006-02-03 17:36:44 UTC (rev 73) +++ trunk/reactos/base/system/servman/servman.c 2006-02-03 18:19:53 UTC (rev 74) @@ -20,6 +20,8 @@
HMENU hShortcutMenu; INT SelectedItem = -1;
+TBBUTTON *ptbb; + extern HWND hwndGenDlg;
@@ -59,7 +61,14 @@ EnableMenuItem(hShortcutMenu, ID_RESUME, MF_GRAYED); EnableMenuItem(hShortcutMenu, ID_RESTART, MF_GRAYED);
- //EnableWindow(hTool, FALSE); + SendMessage(hTool, TB_SETSTATE, ID_START, + (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0)); + SendMessage(hTool, TB_SETSTATE, ID_STOP, + (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0)); + SendMessage(hTool, TB_SETSTATE, ID_PAUSE, + (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0)); + SendMessage(hTool, TB_SETSTATE, ID_RESTART, + (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
if (GetSelectedItem() != -1) { @@ -73,28 +82,42 @@ { EnableMenuItem(hMainMenu, ID_START, MF_ENABLED); EnableMenuItem(hShortcutMenu, ID_START, MF_ENABLED); + SendMessage(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(hShortcutMenu, ID_STOP, MF_ENABLED); + SendMessage(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(hShortcutMenu, ID_PAUSE, MF_ENABLED); + SendMessage(hTool, TB_SETSTATE, ID_PAUSE, + (LPARAM)MAKELONG(TBSTATE_ENABLED, 0)); }
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) ) { EnableMenuItem(hMainMenu, ID_RESTART, MF_ENABLED); EnableMenuItem(hShortcutMenu, ID_RESTART, MF_ENABLED); + SendMessage(hTool, TB_SETSTATE, ID_RESTART, + (LPARAM)MAKELONG(TBSTATE_ENABLED, 0)); } } else + { EnableMenuItem(hMainMenu, ID_PROP, MF_GRAYED); + EnableMenuItem(hMainMenu, ID_DELETE, MF_GRAYED); + EnableMenuItem(hShortcutMenu, ID_DELETE, MF_GRAYED); + SendMessage(hTool, TB_SETSTATE, ID_PROP, + (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0)); + }
}
@@ -114,29 +137,31 @@ /* Toolbar buttons */ TBBUTTON tbb [NUM_BUTTONS] = { /* 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 */ + {TBICON_PROP, ID_PROP, TBSTATE_INDETERMINATE, 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 */ - {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ + {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
- {TBICON_NEW, ID_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* create */ + {TBICON_CREATE, ID_CREATE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* create */
- {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ + {15, 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 */ + {TBICON_START, ID_START, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* start */ + {TBICON_STOP, ID_STOP, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* stop */ + {TBICON_PAUSE, ID_PAUSE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* pause */ + {TBICON_RESTART, ID_RESTART, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* restart */
- {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */ + {15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
- {TBICON_HELP, ID_HELP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* help */ - {TBICON_EXIT, ID_EXIT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* exit */ + {TBICON_HELP, ID_HELP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* help */ + {TBICON_EXIT, ID_EXIT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* exit */
};
+ ptbb = tbb; + /* ======================== Create Toolbar ============================== */
/* Create Toolbar */ @@ -153,7 +178,6 @@ MessageBox(hwnd, _T("Could not create tool bar."), _T("Error"), MB_OK | MB_ICONERROR);
/* Send the TB_BUTTONSTRUCTSIZE message, which is required for backward compatibility */ - SendMessage(hTool, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
/* Add custom images */ @@ -163,7 +187,7 @@ tbb[0].iBitmap += iImageOffset; /* properties */ tbb[1].iBitmap += iImageOffset; /* refresh */ tbb[2].iBitmap += iImageOffset; /* export */ - tbb[4].iBitmap += iImageOffset; /* new */ + tbb[4].iBitmap += iImageOffset; /* create */ tbb[6].iBitmap += iImageOffset; /* start */ tbb[7].iBitmap += iImageOffset; /* stop */ tbb[8].iBitmap += iImageOffset; /* pause */ @@ -330,6 +354,14 @@ if (GetMenuState(hMainMenu, ID_PROP, MF_BYCOMMAND) != MF_ENABLED) EnableMenuItem(hMainMenu, ID_PROP, MF_ENABLED);
+ /* activate delete menu item, if not already */ + if (GetMenuState(hMainMenu, ID_DELETE, MF_BYCOMMAND) != MF_ENABLED) + { + EnableMenuItem(hMainMenu, ID_DELETE, MF_ENABLED); + EnableMenuItem(hShortcutMenu, ID_DELETE, MF_ENABLED); + } + + /* globally set selected service */ SelectedItem = pnmv->iItem;
@@ -342,6 +374,10 @@ /* set current selected service in the status bar */ SendMessage(hStatus, SB_SETTEXT, 1, (LPARAM)Service->lpDisplayName);
+ /* show the properties button */ + SendMessage(hTool, TB_SETSTATE, ID_PROP, + (LPARAM)MAKELONG(TBSTATE_ENABLED, 0)); + } break;
@@ -369,7 +405,7 @@ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXPORT); break;
- case ID_NEW: + case ID_CREATE: lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_NEW); break;
@@ -443,14 +479,40 @@
case ID_EXPORT: ExportFile(hListView); + SetFocus(hListView); break;
- case ID_NEW: + case ID_CREATE: DialogBox(hInstance, MAKEINTRESOURCE(IDD_DLG_CREATE), hMainWnd, (DLGPROC)CreateDialogProc); + SetFocus(hListView); + break;
+ case ID_DELETE: + { + ENUM_SERVICE_STATUS_PROCESS *Service = NULL; + + Service = GetSelectedService(); + + if (Service->ServiceStatusProcess.dwCurrentState != + SERVICE_RUNNING) + { + DialogBox(hInstance, + MAKEINTRESOURCE(IDD_DLG_DELETE), + hMainWnd, + (DLGPROC)DeleteDialogProc); + } + else + { + MessageBox(NULL, _T("You must manually stop the service before deleting!\n"), + _T("Note!"), MB_OK | MB_ICONINFORMATION); + } + + SetFocus(hListView); + + } break;
case ID_START: @@ -578,6 +640,7 @@ case ID_HELP: MessageBox(NULL, _T("Help is not yet implemented\n"), _T("Note!"), MB_OK | MB_ICONINFORMATION); + SetFocus(hListView); break;
case ID_EXIT: @@ -608,6 +671,7 @@ MAKEINTRESOURCE(IDD_ABOUTBOX), hMainWnd, (DLGPROC)AboutDialogProc); + SetFocus(hListView); break;
} _____
Modified: trunk/reactos/base/system/servman/servman.h --- trunk/reactos/base/system/servman/servman.h 2006-02-03 17:36:44 UTC (rev 73) +++ trunk/reactos/base/system/servman/servman.h 2006-02-03 18:19:53 UTC (rev 74) @@ -17,6 +17,7 @@
BOOL CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK CreateDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +BOOL CALLBACK DeleteDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK ProgressDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
BOOL DoStartService(HWND hProgDlg); @@ -30,6 +31,7 @@ VOID FreeMemory(VOID); VOID DisplayString(PTCHAR);
+BOOL SetDescription(HKEY, LPTSTR *); BOOL GetDescription(HKEY, LPTSTR *); BOOL GetExecutablePath(LPTSTR *);
_____
Modified: trunk/reactos/base/system/servman/servman.rbuild --- trunk/reactos/base/system/servman/servman.rbuild 2006-02-03 17:36:44 UTC (rev 73) +++ trunk/reactos/base/system/servman/servman.rbuild 2006-02-03 18:19:53 UTC (rev 74) @@ -19,6 +19,7 @@
<file>about.c</file> <file>control.c</file> <file>create.c</file> + <file>delete.c</file> <file>export.c</file> <file>geterror.c</file> <file>progress.c</file>