X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fsubsys%2Fsystem%2Fservman%2Fservman.c;h=1e774bc99ddc18bb804861617747d77fcee94270;hp=4b84889b05330ef2c953b36507f2f7491efc2ddb;hb=9cfeba8d37e1c5fe3458ccedc6fb0d91e8e75682;hpb=35103e4c37bf373226e53f83ae0f2ddc7c5b76b0;ds=sidebyside diff --git a/reactos/subsys/system/servman/servman.c b/reactos/subsys/system/servman/servman.c index 4b84889b053..1e774bc99dd 100644 --- a/reactos/subsys/system/servman/servman.c +++ b/reactos/subsys/system/servman/servman.c @@ -26,28 +26,33 @@ 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 - {STD_PROPERTIES, ID_PROP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* properties */ - {STD_FILENEW, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* */ - {STD_FILENEW, ID_EXPORT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* */ + { /* 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 */ + + {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 */ + {TBICON_EXIT, ID_EXIT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* pause */ + }; /* ======================== Create Toolbar ============================== */ @@ -76,19 +81,21 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Add custom images */ tbab.hInst = hInstance; tbab.nID = IDB_BUTTONS; - iImageOffset = (INT)SendMessage(hTool, TB_ADDBITMAP, 4, (LPARAM)&tbab); + iImageOffset = (INT)SendMessage(hTool, TB_ADDBITMAP, 11, (LPARAM)&tbab); + tbb[0].iBitmap += iImageOffset; /* properties */ + tbb[1].iBitmap += iImageOffset; /* refresh */ + tbb[2].iBitmap += iImageOffset; /* export */ tbb[4].iBitmap += iImageOffset; /* start */ tbb[5].iBitmap += iImageOffset; /* stop */ - tbb[6].iBitmap += iImageOffset; /* pause */ + tbb[6].iBitmap += iImageOffset; /* pause */ tbb[7].iBitmap += iImageOffset; /* restart */ + tbb[9].iBitmap += iImageOffset; /* new */ + tbb[10].iBitmap += iImageOffset; /* help */ + tbb[11].iBitmap += iImageOffset; /* exit */ /* 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); @@ -108,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); @@ -166,12 +177,15 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SendMessage(hStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM)statwidths); - /* populate the list view with all services */ + +/* ================= populate the list view with all services =================== */ + if (! RefreshServiceList() ) GetError(); } break; + case WM_SIZE: { RECT rcTool; @@ -230,7 +244,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) // Specify the resource identifier of the descriptive // text for the given button. - idButton = lpttt->hdr.idFrom; + idButton = (UINT)lpttt->hdr.idFrom; switch (idButton) { case ID_PROP: @@ -260,6 +274,18 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case ID_RESTART: lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_RESTART); break; + + case ID_NEW: + lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_NEW); + break; + + case ID_HELP: + lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_HELP); + break; + + case ID_EXIT: + lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXIT); + break; } } @@ -284,11 +310,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_START: + case ID_EXPORT: + break; + + case ID_START: break; case ID_STOP: @@ -303,11 +336,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: + MessageBox(NULL, _T("Help is not yet implemented\n"), + _T("Note!"), MB_OK | MB_ICONINFORMATION); + break; + + case ID_EXIT: + PostMessage(hwnd, WM_CLOSE, 0, 0); break; case ID_VIEW_CUSTOMIZE: @@ -320,9 +358,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) AboutDialogProc); break; - case ID_EXPORT: - break; - } break; @@ -332,8 +367,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return 0; } - -//#pragma warning(disable : 4100) +#ifdef _MSC_VER +#pragma warning(disable : 4100) +#endif int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { @@ -396,7 +432,7 @@ int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, DispatchMessage(&Msg); } } - return Msg.wParam; + return (int)Msg.wParam; }