X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fsubsys%2Fsystem%2Fservman%2Fservman.c;h=1e774bc99ddc18bb804861617747d77fcee94270;hp=49ffa6044cbc8baf520e55dd61934b7b89a2b229;hb=9cfeba8d37e1c5fe3458ccedc6fb0d91e8e75682;hpb=b6b7f582ba039c5b059bc3faf1db2a01ff05f500 diff --git a/reactos/subsys/system/servman/servman.c b/reactos/subsys/system/servman/servman.c index 49ffa6044cb..1e774bc99dd 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); @@ -179,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; @@ -243,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: @@ -309,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: @@ -328,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: @@ -345,9 +358,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) AboutDialogProc); break; - case ID_EXPORT: - break; - } break; @@ -357,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) { @@ -421,7 +432,7 @@ int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, DispatchMessage(&Msg); } } - return Msg.wParam; + return (int)Msg.wParam; }