- implement menu hints
- load separate 24bit bitmaps for the icons - fix image list loading - lots of other little tweaks and changes svn path=/trunk/; revision=22238
@@ -8,7 +8,7 @@ BEGIN
|
||||
END
|
||||
POPUP "Action"
|
||||
BEGIN
|
||||
MENUITEM "Connect to...", ID_NET_CON, GRAYED
|
||||
MENUITEM "Connect to...", ID_CONNECT, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Start", ID_START, GRAYED
|
||||
MENUITEM "Stop", ID_STOP, GRAYED
|
||||
@@ -18,7 +18,7 @@ BEGIN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Refresh", ID_REFRESH
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Edit...", ID_EDIT, GRAYED
|
||||
MENUITEM "Edit...", ID_EDIT, GRAYED
|
||||
MENUITEM "Create...", ID_CREATE
|
||||
MENUITEM "Delete...", ID_DELETE, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
@@ -31,13 +31,15 @@ BEGIN
|
||||
MENUITEM "List", ID_VIEW_LIST
|
||||
MENUITEM "Details", ID_VIEW_DETAILS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Customize...",ID_VIEW_CUSTOMIZE, GRAYED
|
||||
MENUITEM "Customize...",ID_VIEW_CUST, GRAYED
|
||||
END
|
||||
POPUP "Help"
|
||||
BEGIN
|
||||
MENUITEM "About...", ID_ABOUT
|
||||
MENUITEM "Help", ID_HELP
|
||||
MENUITEM "About", ID_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
IDR_POPUP MENU
|
||||
BEGIN
|
||||
POPUP "popup"
|
||||
@@ -50,7 +52,7 @@ BEGIN
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Refresh", ID_REFRESH
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Edit...", ID_EDIT, GRAYED
|
||||
MENUITEM "Edit...", ID_EDIT, GRAYED
|
||||
MENUITEM "Delete...", ID_DELETE, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Properties...", ID_PROP, GRAYED
|
||||
@@ -79,7 +81,7 @@ BEGIN
|
||||
EDITTEXT IDC_DISP_NAME, 70, 29, 176, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_READONLY
|
||||
EDITTEXT IDC_DESCRIPTION, 70, 46, 176, 24, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_MULTILINE | ES_READONLY
|
||||
EDITTEXT IDC_EXEPATH, 6, 86, 240, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_READONLY
|
||||
CONTROL "", IDC_START_TYPE, "ComboBox", WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 70, 107, 176, 40
|
||||
COMBOBOX IDC_START_TYPE, 70, 107, 176, 40, WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST
|
||||
PUSHBUTTON "Start", IDC_START, 6, 155, 54, 15, WS_DISABLED
|
||||
PUSHBUTTON "Stop", IDC_STOP, 68, 155, 54, 15, WS_DISABLED
|
||||
PUSHBUTTON "Pause", IDC_PAUSE , 130, 155, 54, 15, WS_DISABLED
|
||||
@@ -101,8 +103,8 @@ CAPTION "Dependencies"
|
||||
FONT 8,"Tahoma",0,0
|
||||
STYLE WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP
|
||||
BEGIN
|
||||
CONTROL "",IDC_DEPEND_TREE1,"SysTreeView32",0x50010007,8,70,236,68,0x00000200
|
||||
CONTROL "",IDC_DEPEND_TREE2,"SysTreeView32",0x50010007,8,151,234,67,0x00000200
|
||||
CONTROL "", IDC_DEPEND_TREE1, "SysTreeView32" ,0x50010007, 8, 70, 236, 68, 0x00000200
|
||||
CONTROL "", IDC_DEPEND_TREE2, "SysTreeView32", 0x50010007, 8, 151, 234, 67, 0x00000200
|
||||
LTEXT "Some services depend on other services, system drivers and load order groups. If a system component is stopped or it is not running properly, dependant services can be affected.", IDC_STATIC,8, 7, 238, 26
|
||||
LTEXT "This service depends on the following components", IDC_STATIC, 8, 57, 236, 9
|
||||
LTEXT "", IDC_DEPEND_SERVICE, 8, 38, 236, 13
|
||||
@@ -113,19 +115,19 @@ CAPTION "Create a service"
|
||||
FONT 8,"Tahoma",0,0
|
||||
STYLE WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP
|
||||
BEGIN
|
||||
CONTROL "",IDC_CREATE_SERVNAME,"Edit",0x50010000,72,12,150,11,0x00000200
|
||||
CONTROL "",IDC_CREATE_DISPNAME,"Edit",0x50010000,72,31,150,11,0x00000200
|
||||
CONTROL "",IDC_CREATE_PATH,"Edit",0x50010000,8,62,214,13,0x00000200
|
||||
CONTROL "",IDC_CREATE_DESC,"Edit",0x50010000,10,97,210,48,0x00000200
|
||||
CONTROL "",IDC_CREATE_OPTIONS,"Edit",0x50010000,10,162,210,13,0x00000200
|
||||
CONTROL "*Service Name :",IDC_STATIC,"Static",0x50000202,12,12,54,9
|
||||
CONTROL "*Display Name :",IDC_STATIC,"Static",0x50000202,12,33,54,9
|
||||
CONTROL "*Path to executable :",IDC_STATIC,"Static",0x50000000,10,51,68,9
|
||||
CONTROL "Description :",IDC_STATIC,"Static",0x50000000,12,86,44,9
|
||||
CONTROL "OK",IDOK,"Button",0x50010000,126,192,44,13
|
||||
CONTROL "Cancel",IDCANCEL,"Button",0x50010000,176,192,46,13
|
||||
CONTROL "Additional options (click help for details)",IDC_STATIC,"Static",0x50000000,10,151,134,9
|
||||
CONTROL "Help",ID_CREATE_HELP,"Button",0x50010000,6,192,44,13
|
||||
EDITTEXT IDC_CREATE_SERVNAME, 72, 12, 150, 11, WS_CHILD | WS_VISIBLE | WS_EX_CLIENTEDGE
|
||||
EDITTEXT IDC_CREATE_DISPNAME, 72, 31, 150, 11, WS_CHILD | WS_VISIBLE
|
||||
EDITTEXT IDC_CREATE_PATH, 8, 62, 214, 13, WS_CHILD | WS_VISIBLE
|
||||
EDITTEXT IDC_CREATE_DESC, 10, 97, 210, 48, WS_CHILD | WS_VISIBLE
|
||||
EDITTEXT IDC_CREATE_OPTIONS, 10, 162, 210, 13, WS_CHILD | WS_VISIBLE
|
||||
LTEXT "*Service Name :", IDC_STATIC, 12, 12, 54, 9
|
||||
LTEXT "*Display Name :", IDC_STATIC, 12, 33, 54, 9
|
||||
LTEXT "*Path to executable :", IDC_STATIC, 10, 51, 68, 9
|
||||
LTEXT "Description :", IDC_STATIC, 12, 86, 44, 9
|
||||
PUSHBUTTON "OK", IDOK, 126, 192, 44, 13
|
||||
PUSHBUTTON "Cancel", IDCANCEL, 176, 192, 46, 13
|
||||
LTEXT "Additional options (click help for details)", IDC_STATIC, 10, 151, 134, 9
|
||||
PUSHBUTTON "Help", ID_CREATE_HELP, 6, 192, 44, 13
|
||||
END
|
||||
|
||||
IDD_DLG_DELETE DIALOGEX 6,6,185,148
|
||||
@@ -157,7 +159,7 @@ FONT 8,"MS Sans Serif",0,0
|
||||
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
|
||||
EXSTYLE WS_EX_TOOLWINDOW
|
||||
BEGIN
|
||||
CONTROL "",IDC_SERVCON_PROGRESS,"msctls_progress32",0x50000000,8,46,238,13
|
||||
CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000, 8, 46, 238, 13
|
||||
LTEXT "", IDC_SERVCON_INFO, 8, 5, 236, 11
|
||||
LTEXT "", IDC_SERVCON_NAME, 8, 25, 66, 11
|
||||
PUSHBUTTON "&Close", IDOK, 100, 70, 54, 13
|
||||
@@ -217,3 +219,62 @@ STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_HELP_OPTIONS "CREATE OPTIONS:\r\nNOTE: The option name includes the equal sign.\r\n type= <own|share|interact|kernel|filesys|rec>\r\n (default = own)\r\n start= <boot|system|auto|demand|disabled>\r\n (default = demand) \r\n error= <normal|severe|critical|ignore>\r\n (default = normal)\r\n group= <LoadOrderGroup>\r\n tag= <yes|no>\r\n depend= <Dependencies(separated by / (forward slash))>\r\n obj= <AccountName|ObjectName>\r\n (default = LocalSystem)\r\n password= <password>\r\n"
|
||||
END
|
||||
#define IDS_HINT_BLANK 20000
|
||||
#define IDS_HINT_EXPORT 20001
|
||||
#define IDS_HINT_EXIT 20002
|
||||
|
||||
#define IDS_HINT_CONNECT 20011
|
||||
#define IDS_HINT_START 20012
|
||||
#define IDS_HINT_STOP 21013
|
||||
#define IDS_HINT_PAUSE 21014
|
||||
#define IDS_HINT_RESUME 20015
|
||||
#define IDS_HINT_RESTART 20016
|
||||
#define IDS_HINT_REFRESH 20017
|
||||
#define IDS_HINT_EDIT 20018
|
||||
#define IDS_HINT_CREATE 20019
|
||||
#define IDS_HINT_DELETE 20020
|
||||
#define IDS_HINT_PROP 20021
|
||||
|
||||
#define IDS_HINT_LARGE 20030
|
||||
#define IDS_HINT_SMALL 20031
|
||||
#define IDS_HINT_LIST 20032
|
||||
#define IDS_HINT_DETAILS 20033
|
||||
#define IDS_HINT_CUST 20034
|
||||
|
||||
#define IDS_HINT_HELP 20040
|
||||
#define IDS_HINT_ABOUT 20041
|
||||
/* Hints */
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_HINT_BLANK " "
|
||||
IDS_HINT_EXPORT " Exports the current list to a file."
|
||||
IDS_HINT_EXIT " Exits the program."
|
||||
|
||||
IDS_HINT_CONNECT " Manage a different computer."
|
||||
IDS_HINT_START " Start the selected service."
|
||||
IDS_HINT_STOP " Stop the selected service."
|
||||
IDS_HINT_PAUSE " Pause the selected service."
|
||||
IDS_HINT_RESUME " Resume the selected service."
|
||||
IDS_HINT_RESTART " Stop and start the selected service."
|
||||
IDS_HINT_REFRESH " Refresh the service list."
|
||||
IDS_HINT_EDIT " Edit the properties of the selected service."
|
||||
IDS_HINT_CREATE " Create a new service."
|
||||
IDS_HINT_DELETE " Delete the selected service."
|
||||
IDS_HINT_PROP " Open property sheet for the current selection."
|
||||
|
||||
IDS_HINT_LARGE " Display items by using large icons."
|
||||
IDS_HINT_SMALL " Display items by using small icons."
|
||||
IDS_HINT_LIST " Display item in a list."
|
||||
IDS_HINT_DETAILS " Display information about each item in a window."
|
||||
IDS_HINT_CUST " Customizes the view."
|
||||
|
||||
IDS_HINT_HELP " Display help window."
|
||||
IDS_HINT_ABOUT " About ReactOS Service Manager."
|
||||
|
||||
IDS_HINT_SYS_RESTORE " Restores this window to normal size."
|
||||
IDS_HINT_SYS_MOVE " Moves this window."
|
||||
IDS_HINT_SYS_SIZE " Resizes this window."
|
||||
IDS_HINT_SYS_MINIMIZE " Collapses this window to an icon."
|
||||
IDS_HINT_SYS_MAXIMIZE " Expands this window to fill this screen."
|
||||
IDS_HINT_SYS_CLOSE " Closes this window."
|
||||
END
|
||||
|
||||
@@ -15,7 +15,7 @@ BOOL bSortAscending = TRUE;
|
||||
|
||||
|
||||
/* Toolbar buttons */
|
||||
TBBUTTON tbb [NUM_BUTTONS] =
|
||||
TBBUTTON Buttons [NUM_BUTTONS] =
|
||||
{ /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
|
||||
{TBICON_PROP, ID_PROP, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0}, /* properties */
|
||||
{TBICON_REFRESH, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* refresh */
|
||||
@@ -25,7 +25,7 @@ TBBUTTON tbb [NUM_BUTTONS] =
|
||||
{15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
|
||||
|
||||
{TBICON_CREATE, ID_CREATE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* create */
|
||||
{TBICON_DELETE, ID_DELETE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* delete */
|
||||
{TBICON_DELETE, ID_DELETE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* delete */
|
||||
|
||||
{15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
|
||||
|
||||
@@ -42,6 +42,92 @@ TBBUTTON tbb [NUM_BUTTONS] =
|
||||
};
|
||||
|
||||
|
||||
/* menu hints */
|
||||
static const MENU_HINT MainMenuHintTable[] = {
|
||||
/* File Menu */
|
||||
{ID_EXPORT, IDS_HINT_EXPORT},
|
||||
{ID_EXIT, IDS_HINT_EXIT},
|
||||
|
||||
/* Action Menu */
|
||||
{ID_CONNECT, IDS_HINT_CONNECT},
|
||||
{ID_START, IDS_HINT_START},
|
||||
{ID_STOP, IDS_HINT_STOP},
|
||||
{ID_PAUSE, IDS_HINT_PAUSE},
|
||||
{ID_RESUME, IDS_HINT_RESUME},
|
||||
{ID_RESTART, IDS_HINT_RESTART},
|
||||
{ID_REFRESH, IDS_HINT_REFRESH},
|
||||
{ID_EDIT, IDS_HINT_EDIT},
|
||||
{ID_CREATE, IDS_HINT_CREATE},
|
||||
{ID_DELETE, IDS_HINT_DELETE},
|
||||
{ID_PROP, IDS_HINT_PROP},
|
||||
|
||||
/* View menu */
|
||||
{ID_VIEW_LARGE, IDS_HINT_LARGE},
|
||||
{ID_VIEW_SMALL, IDS_HINT_SMALL},
|
||||
{ID_VIEW_LIST, IDS_HINT_LIST},
|
||||
{ID_VIEW_DETAILS, IDS_HINT_DETAILS},
|
||||
{ID_VIEW_CUST, IDS_HINT_CUST},
|
||||
|
||||
/* Help Menu */
|
||||
{ID_HELP, IDS_HINT_HELP},
|
||||
{ID_ABOUT, IDS_HINT_ABOUT}
|
||||
};
|
||||
/* system menu hints */
|
||||
static const MENU_HINT SystemMenuHintTable[] = {
|
||||
{SC_RESTORE, IDS_HINT_SYS_RESTORE},
|
||||
{SC_MOVE, IDS_HINT_SYS_MOVE},
|
||||
{SC_SIZE, IDS_HINT_SYS_SIZE},
|
||||
{SC_MINIMIZE, IDS_HINT_SYS_MINIMIZE},
|
||||
{SC_MAXIMIZE, IDS_HINT_SYS_MAXIMIZE},
|
||||
{SC_CLOSE, IDS_HINT_SYS_CLOSE},
|
||||
};
|
||||
|
||||
|
||||
static BOOL
|
||||
MainWndMenuHint(PMAIN_WND_INFO Info,
|
||||
WORD CmdId,
|
||||
const MENU_HINT *HintArray,
|
||||
DWORD HintsCount,
|
||||
UINT DefHintId)
|
||||
{
|
||||
BOOL Found = FALSE;
|
||||
const MENU_HINT *LastHint;
|
||||
UINT HintId = DefHintId;
|
||||
|
||||
LastHint = HintArray + HintsCount;
|
||||
while (HintArray != LastHint)
|
||||
{
|
||||
if (HintArray->CmdId == CmdId)
|
||||
{
|
||||
HintId = HintArray->HintId;
|
||||
Found = TRUE;
|
||||
break;
|
||||
}
|
||||
HintArray++;
|
||||
}
|
||||
|
||||
StatusBarLoadString(Info->hStatus,
|
||||
SB_SIMPLEID,
|
||||
hInstance,
|
||||
HintId);
|
||||
|
||||
return Found;
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
UpdateMainStatusBar(PMAIN_WND_INFO Info)
|
||||
{
|
||||
if (Info->hStatus != NULL)
|
||||
{
|
||||
SendMessage(Info->hStatus,
|
||||
SB_SIMPLE,
|
||||
(WPARAM)Info->InMenuLoop,
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
SetListViewStyle(HWND hListView,
|
||||
DWORD View)
|
||||
@@ -89,6 +175,12 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
|
||||
|
||||
if (Info->SelectedItem != NO_ITEM_SELECTED)
|
||||
{
|
||||
/* allow user to delete service */
|
||||
SendMessage(Info->hTool, TB_SETSTATE, ID_DELETE,
|
||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||
EnableMenuItem(hMainMenu, ID_DELETE, MF_ENABLED);
|
||||
EnableMenuItem(Info->hShortcutMenu, ID_DELETE, MF_ENABLED);
|
||||
|
||||
Flags = Info->CurrentService->ServiceStatusProcess.dwControlsAccepted;
|
||||
State = Info->CurrentService->ServiceStatusProcess.dwCurrentState;
|
||||
|
||||
@@ -126,11 +218,15 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* disable tools which rely on a selected service */
|
||||
EnableMenuItem(hMainMenu, ID_PROP, MF_GRAYED);
|
||||
EnableMenuItem(hMainMenu, ID_DELETE, MF_GRAYED);
|
||||
EnableMenuItem(Info->hShortcutMenu, ID_PROP, MF_GRAYED);
|
||||
EnableMenuItem(Info->hShortcutMenu, ID_DELETE, MF_GRAYED);
|
||||
SendMessage(Info->hTool, TB_SETSTATE, ID_PROP,
|
||||
(LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
|
||||
SendMessage(Info->hTool, TB_SETSTATE, ID_DELETE,
|
||||
(LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -156,101 +252,55 @@ CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
||||
}
|
||||
|
||||
|
||||
/*FIXME: needs rewriting / optimising */
|
||||
static VOID CALLBACK
|
||||
MainWndResize(PVOID Context,
|
||||
WORD cx,
|
||||
WORD cy)
|
||||
{
|
||||
PMAIN_WND_INFO Info = (PMAIN_WND_INFO)Context;
|
||||
|
||||
RECT rcClient, rcTool, rcStatus;
|
||||
int lvHeight, iToolHeight, iStatusHeight;
|
||||
|
||||
/* Size toolbar and get height */
|
||||
Info->hTool = GetDlgItem(Info->hMainWnd, IDC_TOOLBAR);
|
||||
SendMessage(Info->hTool, TB_AUTOSIZE, 0, 0);
|
||||
|
||||
GetWindowRect(Info->hTool, &rcTool);
|
||||
iToolHeight = rcTool.bottom - rcTool.top;
|
||||
|
||||
/* Size status bar and get height */
|
||||
Info->hStatus = GetDlgItem(Info->hMainWnd, IDC_STATUSBAR);
|
||||
SendMessage(Info->hStatus, WM_SIZE, 0, 0);
|
||||
|
||||
GetWindowRect(Info->hStatus, &rcStatus);
|
||||
iStatusHeight = rcStatus.bottom - rcStatus.top;
|
||||
|
||||
/* Calculate remaining height and size list view */
|
||||
GetClientRect(Info->hMainWnd, &rcClient);
|
||||
|
||||
lvHeight = rcClient.bottom - iToolHeight - iStatusHeight;
|
||||
|
||||
Info->hListView = GetDlgItem(Info->hMainWnd, IDC_SERVLIST);
|
||||
SetWindowPos(Info->hListView, NULL, 0, iToolHeight, rcClient.right, lvHeight, SWP_NOZORDER);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
static BOOL
|
||||
CreateToolbar(PMAIN_WND_INFO Info)
|
||||
{
|
||||
TBADDBITMAP tbab;
|
||||
INT iImageOffset;
|
||||
INT NumButtons;
|
||||
INT NumButtons = sizeof(Buttons) / sizeof(Buttons[0]);
|
||||
|
||||
Info->hTool = CreateWindowEx(0, //WS_EX_TOOLWINDOW
|
||||
Info->hTool = CreateWindowEx(0,
|
||||
TOOLBARCLASSNAME,
|
||||
NULL,
|
||||
WS_CHILD | WS_VISIBLE | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS,
|
||||
0, 0, 0, 0,
|
||||
Info->hMainWnd,
|
||||
(HMENU)IDC_TOOLBAR,
|
||||
0,
|
||||
hInstance,
|
||||
NULL);
|
||||
if(Info->hTool == NULL)
|
||||
if(Info->hTool != NULL)
|
||||
{
|
||||
MessageBox(Info->hMainWnd,
|
||||
_T("Could not create tool bar."),
|
||||
_T("Error"),
|
||||
MB_OK | MB_ICONERROR);
|
||||
HIMAGELIST hImageList;
|
||||
|
||||
SendMessage(Info->hTool,
|
||||
TB_SETEXTENDEDSTYLE,
|
||||
0,
|
||||
TBSTYLE_EX_HIDECLIPPEDBUTTONS);
|
||||
|
||||
SendMessage(Info->hTool,
|
||||
TB_BUTTONSTRUCTSIZE,
|
||||
sizeof(Buttons[0]),
|
||||
0);
|
||||
|
||||
hImageList = InitImageList(IDB_PROP,
|
||||
IDB_EXIT,
|
||||
16,
|
||||
16);
|
||||
if (hImageList == NULL)
|
||||
return FALSE;
|
||||
|
||||
ImageList_Destroy((HIMAGELIST)SendMessage(Info->hTool,
|
||||
TB_SETIMAGELIST,
|
||||
0,
|
||||
(LPARAM)hImageList));
|
||||
|
||||
SendMessage(Info->hTool,
|
||||
TB_ADDBUTTONS,
|
||||
NumButtons,
|
||||
(LPARAM)Buttons);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Send the TB_BUTTONSTRUCTSIZE message, which is required for backward compatibility */
|
||||
SendMessage(Info->hTool,
|
||||
TB_BUTTONSTRUCTSIZE,
|
||||
sizeof(TBBUTTON),
|
||||
0);
|
||||
|
||||
NumButtons = sizeof(tbb) / sizeof(tbb[0]);
|
||||
|
||||
/* Add custom images */
|
||||
tbab.hInst = hInstance;
|
||||
tbab.nID = IDB_BUTTONS;
|
||||
iImageOffset = (INT)SendMessage(Info->hTool,
|
||||
TB_ADDBITMAP,
|
||||
NumButtons,
|
||||
(LPARAM)&tbab);
|
||||
tbb[0].iBitmap += iImageOffset; /* properties */
|
||||
tbb[1].iBitmap += iImageOffset; /* refresh */
|
||||
tbb[2].iBitmap += iImageOffset; /* export */
|
||||
tbb[4].iBitmap += iImageOffset; /* create */
|
||||
tbb[5].iBitmap += iImageOffset; /* delete */
|
||||
tbb[7].iBitmap += iImageOffset; /* start */
|
||||
tbb[8].iBitmap += iImageOffset; /* stop */
|
||||
tbb[9].iBitmap += iImageOffset; /* pause */
|
||||
tbb[10].iBitmap += iImageOffset; /* restart */
|
||||
tbb[12].iBitmap += iImageOffset; /* help */
|
||||
tbb[13].iBitmap += iImageOffset; /* exit */
|
||||
|
||||
/* Add buttons to toolbar */
|
||||
SendMessage(Info->hTool,
|
||||
TB_ADDBUTTONS,
|
||||
NumButtons,
|
||||
(LPARAM) &tbb);
|
||||
|
||||
/* Show toolbar */
|
||||
ShowWindow(Info->hTool,
|
||||
SW_SHOWNORMAL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -350,7 +400,7 @@ CreateListView(PMAIN_WND_INFO Info)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static VOID
|
||||
static BOOL
|
||||
CreateStatusBar(PMAIN_WND_INFO Info)
|
||||
{
|
||||
INT StatWidths[] = {110, -1}; /* widths of status bar */
|
||||
@@ -365,30 +415,90 @@ CreateStatusBar(PMAIN_WND_INFO Info)
|
||||
hInstance,
|
||||
NULL);
|
||||
if(Info->hStatus == NULL)
|
||||
{
|
||||
MessageBox(Info->hMainWnd,
|
||||
_T("Could not create status bar."),
|
||||
_T("Error!"),
|
||||
MB_OK | MB_ICONERROR);
|
||||
return;
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
|
||||
SendMessage(Info->hStatus,
|
||||
SB_SETPARTS,
|
||||
sizeof(StatWidths) / sizeof(INT),
|
||||
(LPARAM)StatWidths);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static VOID
|
||||
ListViewSelectionChanged(PMAIN_WND_INFO Info,
|
||||
LPNMLISTVIEW pnmv)
|
||||
{
|
||||
|
||||
HMENU hMainMenu;
|
||||
|
||||
/* get handle to menu */
|
||||
hMainMenu = GetMenu(Info->hMainWnd);
|
||||
|
||||
/* activate properties menu item, if not already */
|
||||
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(Info->hShortcutMenu,
|
||||
ID_DELETE,
|
||||
MF_ENABLED);
|
||||
}
|
||||
|
||||
|
||||
/* set selected service */
|
||||
Info->SelectedItem = pnmv->iItem;
|
||||
|
||||
/* get pointer to selected service */
|
||||
Info->CurrentService = GetSelectedService(Info);
|
||||
|
||||
/* alter options for the service */
|
||||
SetMenuAndButtonStates(Info);
|
||||
|
||||
/* set current selected service in the status bar */
|
||||
SendMessage(Info->hStatus,
|
||||
SB_SETTEXT,
|
||||
1,
|
||||
(LPARAM)Info->CurrentService->lpDisplayName);
|
||||
|
||||
/* show the properties button */
|
||||
SendMessage(Info->hTool,
|
||||
TB_SETSTATE,
|
||||
ID_PROP,
|
||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
InitMainWnd(PMAIN_WND_INFO Info)
|
||||
{
|
||||
CreateToolbar(Info);
|
||||
if (!CreateToolbar(Info))
|
||||
DisplayString(_T("error creating toolbar"));
|
||||
|
||||
if (!CreateListView(Info))
|
||||
{
|
||||
DisplayString(_T("error creating list view"));
|
||||
return;
|
||||
}
|
||||
|
||||
CreateStatusBar(Info);
|
||||
if (!CreateStatusBar(Info))
|
||||
DisplayString(_T("error creating status bar"));
|
||||
|
||||
/* Create Popup Menu */
|
||||
Info->hShortcutMenu = LoadMenu(hInstance,
|
||||
@@ -564,7 +674,7 @@ MainWndCommand(PMAIN_WND_INFO Info,
|
||||
LVS_REPORT);
|
||||
break;
|
||||
|
||||
case ID_VIEW_CUSTOMIZE:
|
||||
case ID_VIEW_CUST:
|
||||
break;
|
||||
|
||||
case ID_ABOUT:
|
||||
@@ -579,6 +689,37 @@ MainWndCommand(PMAIN_WND_INFO Info,
|
||||
}
|
||||
|
||||
|
||||
static VOID CALLBACK
|
||||
MainWndResize(PMAIN_WND_INFO Info,
|
||||
WORD cx,
|
||||
WORD cy)
|
||||
{
|
||||
RECT rcClient, rcTool, rcStatus;
|
||||
int lvHeight, iToolHeight, iStatusHeight;
|
||||
|
||||
/* Size toolbar and get height */
|
||||
SendMessage(Info->hTool, TB_AUTOSIZE, 0, 0);
|
||||
GetWindowRect(Info->hTool, &rcTool);
|
||||
iToolHeight = rcTool.bottom - rcTool.top;
|
||||
|
||||
/* Size status bar and get height */
|
||||
SendMessage(Info->hStatus, WM_SIZE, 0, 0);
|
||||
GetWindowRect(Info->hStatus, &rcStatus);
|
||||
iStatusHeight = rcStatus.bottom - rcStatus.top;
|
||||
|
||||
/* Calculate remaining height and size list view */
|
||||
GetClientRect(Info->hMainWnd, &rcClient);
|
||||
lvHeight = rcClient.bottom - iToolHeight - iStatusHeight;
|
||||
SetWindowPos(Info->hListView,
|
||||
NULL,
|
||||
0,
|
||||
iToolHeight,
|
||||
rcClient.right,
|
||||
lvHeight,
|
||||
SWP_NOZORDER);
|
||||
}
|
||||
|
||||
|
||||
static LRESULT CALLBACK
|
||||
MainWndProc(HWND hwnd,
|
||||
UINT msg,
|
||||
@@ -669,55 +810,8 @@ MainWndProc(HWND hwnd,
|
||||
case LVN_ITEMCHANGED:
|
||||
{
|
||||
LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
|
||||
HMENU hMainMenu;
|
||||
|
||||
/* get handle to menu */
|
||||
hMainMenu = GetMenu(Info->hMainWnd);
|
||||
|
||||
/* activate properties menu item, if not already */
|
||||
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(Info->hShortcutMenu,
|
||||
ID_DELETE,
|
||||
MF_ENABLED);
|
||||
}
|
||||
|
||||
|
||||
/* set selected service */
|
||||
Info->SelectedItem = pnmv->iItem;
|
||||
|
||||
/* get pointer to selected service */
|
||||
Info->CurrentService = GetSelectedService(Info);
|
||||
|
||||
/* alter options for the service */
|
||||
SetMenuAndButtonStates(Info);
|
||||
|
||||
/* set current selected service in the status bar */
|
||||
SendMessage(Info->hStatus,
|
||||
SB_SETTEXT,
|
||||
1,
|
||||
(LPARAM)Info->CurrentService->lpDisplayName);
|
||||
|
||||
/* show the properties button */
|
||||
SendMessage(Info->hTool,
|
||||
TB_SETSTATE,
|
||||
ID_PROP,
|
||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||
ListViewSelectionChanged(Info, pnmv);
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -781,9 +875,6 @@ MainWndProc(HWND hwnd,
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -820,6 +911,40 @@ MainWndProc(HWND hwnd,
|
||||
goto HandleDefaultMessage;
|
||||
}
|
||||
|
||||
case WM_MENUSELECT:
|
||||
{
|
||||
if (Info->hStatus != NULL)
|
||||
{
|
||||
if (!MainWndMenuHint(Info,
|
||||
LOWORD(wParam),
|
||||
MainMenuHintTable,
|
||||
sizeof(MainMenuHintTable) / sizeof(MainMenuHintTable[0]),
|
||||
IDS_HINT_BLANK))
|
||||
{
|
||||
MainWndMenuHint(Info,
|
||||
LOWORD(wParam),
|
||||
SystemMenuHintTable,
|
||||
sizeof(SystemMenuHintTable) / sizeof(SystemMenuHintTable[0]),
|
||||
IDS_HINT_BLANK);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_ENTERMENULOOP:
|
||||
{
|
||||
Info->InMenuLoop = TRUE;
|
||||
UpdateMainStatusBar(Info);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_EXITMENULOOP:
|
||||
{
|
||||
Info->InMenuLoop = FALSE;
|
||||
UpdateMainStatusBar(Info);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CLOSE:
|
||||
{
|
||||
/* Free service array */
|
||||
|
||||
@@ -216,27 +216,26 @@ VOID DisplayString(PTCHAR Msg)
|
||||
|
||||
|
||||
HIMAGELIST
|
||||
InitImageList(UINT NumImages,
|
||||
UINT StartResource,
|
||||
InitImageList(UINT StartResource,
|
||||
UINT EndResource,
|
||||
UINT Width,
|
||||
UINT Height)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
HIMAGELIST hImageList;
|
||||
INT i, k, Ret;
|
||||
|
||||
INT i, Ret;
|
||||
|
||||
/* Create the toolbar icon image list */
|
||||
hImageList = ImageList_Create(Width,
|
||||
Height,
|
||||
ILC_MASK | ILC_COLOR24,
|
||||
NumImages,
|
||||
EndResource - StartResource,
|
||||
0);
|
||||
if (! hImageList)
|
||||
if (hImageList == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Add all icons to the image list */
|
||||
for (i = StartResource, k = 0; k < NumImages; i++, k++)
|
||||
for (i = StartResource; i <= EndResource; i++)
|
||||
{
|
||||
hBitmap = LoadImage(hInstance,
|
||||
MAKEINTRESOURCE(i),
|
||||
@@ -244,14 +243,17 @@ InitImageList(UINT NumImages,
|
||||
Width,
|
||||
Height,
|
||||
LR_LOADTRANSPARENT);
|
||||
if (hBitmap == NULL)
|
||||
return NULL;
|
||||
|
||||
Ret = ImageList_AddMasked(hImageList,
|
||||
hBitmap,
|
||||
RGB(255, 255, 254));
|
||||
RGB(255, 0, 128));
|
||||
if (Ret == -1)
|
||||
return NULL;
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
}
|
||||
|
||||
return hImageList;
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
#pragma warning(disable : 4100)
|
||||
#endif
|
||||
|
||||
#ifndef SB_SIMPLEID
|
||||
#define SB_SIMPLEID 0xFF
|
||||
#endif
|
||||
|
||||
#define NO_ITEM_SELECTED -1
|
||||
#define MAX_KEY_LENGTH 256
|
||||
#define NUM_BUTTONS 14
|
||||
@@ -54,6 +58,9 @@ typedef struct _MAIN_WND_INFO
|
||||
|
||||
struct _PROP_DLG_INFO *PropSheet;
|
||||
|
||||
/* status flags */
|
||||
BOOL InMenuLoop : 1;
|
||||
|
||||
} MAIN_WND_INFO, *PMAIN_WND_INFO;
|
||||
|
||||
|
||||
@@ -68,6 +75,12 @@ extern HINSTANCE hInstance;
|
||||
extern HANDLE ProcessHeap;
|
||||
|
||||
/* mainwnd.c */
|
||||
typedef struct _MENU_HINT
|
||||
{
|
||||
WORD CmdId;
|
||||
UINT HintId;
|
||||
} MENU_HINT, *PMENU_HINT;
|
||||
|
||||
BOOL InitMainWindowImpl(VOID);
|
||||
VOID UninitMainWindowImpl(VOID);
|
||||
HWND CreateMainWindow(LPCTSTR lpCaption, int nCmdShow);
|
||||
|
||||
@@ -259,9 +259,6 @@ GeneralPageProc(HWND hwndDlg,
|
||||
/* Enable the 'Apply' button */
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -312,12 +309,7 @@ DependanciesPageProc(HWND hwndDlg,
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDC_START:
|
||||
break;
|
||||
|
||||
case IDC_STOP:
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -329,9 +321,10 @@ DependanciesPageProc(HWND hwndDlg,
|
||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||
|
||||
switch (lpnm->code)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 822 B |
|
Before Width: | Height: | Size: 3.8 KiB |
@@ -7,9 +7,8 @@
|
||||
#define IDS_LICENSE 203
|
||||
|
||||
#define IDC_SERVLIST 1000
|
||||
#define IDC_TOOLBAR 1001
|
||||
#define IDC_STATUSBAR 1002
|
||||
#define IDC_EDIT_BUTTON 1003
|
||||
#define IDC_STATUSBAR 1001
|
||||
#define IDC_EDIT_BUTTON 1002
|
||||
|
||||
#define ID_PROP 2000
|
||||
#define ID_REFRESH 2001
|
||||
@@ -24,11 +23,11 @@
|
||||
#define ID_DELETE 2010
|
||||
#define ID_HELP 2011
|
||||
#define ID_EXIT 2012
|
||||
#define ID_NET_CON 2013
|
||||
#define ID_CONNECT 2013
|
||||
|
||||
#define IDR_MAINMENU 102
|
||||
#define IDR_POPUP 103
|
||||
#define ID_VIEW_CUSTOMIZE 4021
|
||||
#define ID_VIEW_CUST 4021
|
||||
#define ID_VIEW_LARGE 4022
|
||||
#define ID_VIEW_SMALL 4023
|
||||
#define ID_VIEW_LIST 4024
|
||||
@@ -65,6 +64,18 @@
|
||||
#define IDI_SM_ICON 50
|
||||
#define IDB_BUTTONS 51
|
||||
|
||||
#define IDB_PROP 10000
|
||||
#define IDB_REFRESH 10001
|
||||
#define IDB_EXPORT 10002
|
||||
#define IDB_CREATE 10003
|
||||
#define IDB_DELETE 10004
|
||||
#define IDB_START 10005
|
||||
#define IDB_STOP 10006
|
||||
#define IDB_PAUSE 10007
|
||||
#define IDB_RESTART 10008
|
||||
#define IDB_HELP 10009
|
||||
#define IDB_EXIT 10010
|
||||
|
||||
/* toolbar buttons */
|
||||
#define TBICON_PROP 0
|
||||
#define TBICON_REFRESH 1
|
||||
@@ -78,6 +89,42 @@
|
||||
#define TBICON_HELP 9
|
||||
#define TBICON_EXIT 10
|
||||
|
||||
|
||||
/* menu hints */
|
||||
#define IDS_HINT_BLANK 20000
|
||||
#define IDS_HINT_EXPORT 20001
|
||||
#define IDS_HINT_EXIT 20002
|
||||
|
||||
#define IDS_HINT_CONNECT 20011
|
||||
#define IDS_HINT_START 20012
|
||||
#define IDS_HINT_STOP 21013
|
||||
#define IDS_HINT_PAUSE 21014
|
||||
#define IDS_HINT_RESUME 20015
|
||||
#define IDS_HINT_RESTART 20016
|
||||
#define IDS_HINT_REFRESH 20017
|
||||
#define IDS_HINT_EDIT 20018
|
||||
#define IDS_HINT_CREATE 20019
|
||||
#define IDS_HINT_DELETE 20020
|
||||
#define IDS_HINT_PROP 20021
|
||||
|
||||
#define IDS_HINT_LARGE 20030
|
||||
#define IDS_HINT_SMALL 20031
|
||||
#define IDS_HINT_LIST 20032
|
||||
#define IDS_HINT_DETAILS 20033
|
||||
#define IDS_HINT_CUST 20034
|
||||
|
||||
#define IDS_HINT_HELP 20040
|
||||
#define IDS_HINT_ABOUT 20041
|
||||
|
||||
/* system menu hints */
|
||||
#define IDS_HINT_SYS_RESTORE 21001
|
||||
#define IDS_HINT_SYS_MOVE 21002
|
||||
#define IDS_HINT_SYS_SIZE 21003
|
||||
#define IDS_HINT_SYS_MINIMIZE 21004
|
||||
#define IDS_HINT_SYS_MAXIMIZE 21005
|
||||
#define IDS_HINT_SYS_CLOSE 21006
|
||||
|
||||
|
||||
/* properties dialog */
|
||||
#define IDD_DLG_GENERAL 10001
|
||||
#define IDC_SERV_NAME 10041
|
||||
|
||||
@@ -18,6 +18,19 @@ BEGIN
|
||||
END
|
||||
|
||||
IDI_SM_ICON ICON "res/system.ico"
|
||||
IDB_BUTTONS BITMAP DISCARDABLE "res/toolbar.bmp"
|
||||
|
||||
/* main toolbar icons */
|
||||
IDB_PROP BITMAP DISCARDABLE "res/properties.bmp"
|
||||
IDB_REFRESH BITMAP DISCARDABLE "res/refresh.bmp"
|
||||
IDB_EXPORT BITMAP DISCARDABLE "res/export.bmp"
|
||||
IDB_CREATE BITMAP DISCARDABLE "res/create.bmp"
|
||||
IDB_DELETE BITMAP DISCARDABLE "res/delete.bmp"
|
||||
IDB_START BITMAP DISCARDABLE "res/start.bmp"
|
||||
IDB_STOP BITMAP DISCARDABLE "res/stop.bmp"
|
||||
IDB_PAUSE BITMAP DISCARDABLE "res/pause.bmp"
|
||||
IDB_RESTART BITMAP DISCARDABLE "res/restart.bmp"
|
||||
IDB_HELP BITMAP DISCARDABLE "res/help.bmp"
|
||||
IDB_EXIT BITMAP DISCARDABLE "res/exit.bmp"
|
||||
|
||||
|
||||
#include "En.rc"
|
||||
|
||||