fix msvc warnings
[reactos.git] / reactos / subsys / system / servman / servman.c
index 49ffa60..1e774bc 100644 (file)
@@ -26,30 +26,28 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
         {\r
              //HFONT hfDefault;\r
 \r
         {\r
              //HFONT hfDefault;\r
 \r
-            HWND hTool;\r
             TBADDBITMAP tbab;\r
             INT iImageOffset;\r
             TBADDBITMAP tbab;\r
             INT iImageOffset;\r
-            INT statwidths[] = {110, -1};\r
+            INT statwidths[] = {110, -1}; /* widths of status bar */\r
             TCHAR szTemp[256];\r
             TCHAR szTemp[256];\r
-            RECT rcClient;\r
             LVCOLUMN lvc = { 0 };\r
 \r
             /* Toolbar buttons */\r
             TBBUTTON tbb [NUM_BUTTONS] = \r
             LVCOLUMN lvc = { 0 };\r
 \r
             /* Toolbar buttons */\r
             TBBUTTON tbb [NUM_BUTTONS] = \r
-            { // iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString\r
+            {   /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */\r
                 {TBICON_PROP,    ID_PROP,    TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0},    /* properties */\r
                 {TBICON_REFRESH, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0},    /* refresh */\r
                 {TBICON_EXPORT,  ID_EXPORT,  TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0},    /* export */\r
 \r
                 /* Note: First item for a seperator is its width in pixels */\r
                 {TBICON_PROP,    ID_PROP,    TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0},    /* properties */\r
                 {TBICON_REFRESH, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0},    /* refresh */\r
                 {TBICON_EXPORT,  ID_EXPORT,  TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0},    /* export */\r
 \r
                 /* Note: First item for a seperator is its width in pixels */\r
-                {5, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},                             /* separator */\r
+                {25, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},                             /* separator */\r
 \r
                 {TBICON_START,   ID_START,   TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* start */ \r
                 {TBICON_STOP,    ID_STOP,    TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* stop */\r
                 {TBICON_PAUSE,   ID_PAUSE,   TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* pause */   \r
                 {TBICON_RESTART, ID_RESTART, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* restart */\r
 \r
 \r
                 {TBICON_START,   ID_START,   TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* start */ \r
                 {TBICON_STOP,    ID_STOP,    TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* stop */\r
                 {TBICON_PAUSE,   ID_PAUSE,   TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* pause */   \r
                 {TBICON_RESTART, ID_RESTART, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* restart */\r
 \r
-                {5, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},                             /* separator */\r
+                {25, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0},                             /* separator */\r
 \r
                 {TBICON_NEW,     ID_NEW,   TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* start */\r
                 {TBICON_HELP,    ID_HELP,    TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* stop */\r
 \r
                 {TBICON_NEW,     ID_NEW,   TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* start */\r
                 {TBICON_HELP,    ID_HELP,    TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 },   /* stop */\r
@@ -98,10 +96,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             /* Add buttons to toolbar */\r
             SendMessage(hTool, TB_ADDBUTTONS, NUM_BUTTONS, (LPARAM) &tbb);\r
 \r
             /* Add buttons to toolbar */\r
             SendMessage(hTool, TB_ADDBUTTONS, NUM_BUTTONS, (LPARAM) &tbb);\r
 \r
-            /* Send a WM_SIZE message to layout controls */\r
-            GetClientRect(hwnd, &rcClient);\r
-            SendMessage(hwnd, WM_SIZE, SIZE_RESTORED, MAKELONG(rcClient.right, rcClient.bottom));\r
-\r
             /* Show toolbar */\r
             ShowWindow(hTool, SW_SHOWNORMAL);\r
 \r
             /* Show toolbar */\r
             ShowWindow(hTool, SW_SHOWNORMAL);\r
 \r
@@ -121,39 +115,43 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             if (hListView == NULL)\r
                 MessageBox(hwnd, _T("Could not create List View."), _T("Error"), MB_OK | MB_ICONERROR);\r
 \r
             if (hListView == NULL)\r
                 MessageBox(hwnd, _T("Could not create List View."), _T("Error"), MB_OK | MB_ICONERROR);\r
 \r
-\r
-\r
             ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT |\r
             ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT |\r
-                    /*LVS_EX_GRIDLINES |*/ LVS_EX_HEADERDRAGDROP);\r
+                    LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP);\r
 \r
             lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH  | LVCF_FMT;\r
             lvc.fmt  = LVCFMT_LEFT;\r
 \r
 \r
             lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH  | LVCF_FMT;\r
             lvc.fmt  = LVCFMT_LEFT;\r
 \r
-            /* Add columns to the list-view (first column contains check box). */\r
+            /* Add columns to the list-view */\r
+\r
+            /* name */\r
             lvc.iSubItem = 0;\r
             lvc.cx       = 160;\r
             LoadString(hInstance, IDS_FIRSTCOLUMN, szTemp, 256);\r
             lvc.pszText  = szTemp;\r
             ListView_InsertColumn(hListView, 0, &lvc);\r
 \r
             lvc.iSubItem = 0;\r
             lvc.cx       = 160;\r
             LoadString(hInstance, IDS_FIRSTCOLUMN, szTemp, 256);\r
             lvc.pszText  = szTemp;\r
             ListView_InsertColumn(hListView, 0, &lvc);\r
 \r
+            /* description */\r
             lvc.iSubItem = 1;\r
             lvc.cx       = 260;\r
             LoadString(hInstance, IDS_SECONDCOLUMN, szTemp, 256);\r
             lvc.pszText  = szTemp;\r
             ListView_InsertColumn(hListView, 1, &lvc);\r
 \r
             lvc.iSubItem = 1;\r
             lvc.cx       = 260;\r
             LoadString(hInstance, IDS_SECONDCOLUMN, szTemp, 256);\r
             lvc.pszText  = szTemp;\r
             ListView_InsertColumn(hListView, 1, &lvc);\r
 \r
+            /* status */\r
             lvc.iSubItem = 2;\r
             lvc.cx       = 75;\r
             LoadString(hInstance, IDS_THIRDCOLUMN, szTemp, 256);\r
             lvc.pszText  = szTemp;\r
             ListView_InsertColumn(hListView, 2, &lvc);\r
 \r
             lvc.iSubItem = 2;\r
             lvc.cx       = 75;\r
             LoadString(hInstance, IDS_THIRDCOLUMN, szTemp, 256);\r
             lvc.pszText  = szTemp;\r
             ListView_InsertColumn(hListView, 2, &lvc);\r
 \r
+            /* startup type */\r
             lvc.iSubItem = 3;\r
             lvc.cx       = 80;\r
             LoadString(hInstance, IDS_FOURTHCOLUMN, szTemp, 256);\r
             lvc.pszText  = szTemp;\r
             ListView_InsertColumn(hListView, 3, &lvc);\r
 \r
             lvc.iSubItem = 3;\r
             lvc.cx       = 80;\r
             LoadString(hInstance, IDS_FOURTHCOLUMN, szTemp, 256);\r
             lvc.pszText  = szTemp;\r
             ListView_InsertColumn(hListView, 3, &lvc);\r
 \r
+            /* logon as */\r
             lvc.iSubItem = 4;\r
             lvc.cx       = 100;\r
             LoadString(hInstance, IDS_FITHCOLUMN, szTemp, 256);\r
             lvc.iSubItem = 4;\r
             lvc.cx       = 100;\r
             LoadString(hInstance, IDS_FITHCOLUMN, szTemp, 256);\r
@@ -179,12 +177,15 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 \r
                    SendMessage(hStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM)statwidths);\r
 \r
 \r
                    SendMessage(hStatus, SB_SETPARTS, sizeof(statwidths)/sizeof(int), (LPARAM)statwidths);\r
 \r
-                   /* populate the list view with all services */\r
+\r
+/* ================= populate the list view with all services =================== */\r
+\r
                    if (! RefreshServiceList() )\r
                 GetError();\r
 \r
            }\r
            break;\r
                    if (! RefreshServiceList() )\r
                 GetError();\r
 \r
            }\r
            break;\r
+\r
            case WM_SIZE:\r
            {\r
                    RECT rcTool;\r
            case WM_SIZE:\r
            {\r
                    RECT rcTool;\r
@@ -243,7 +244,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 \r
                     // Specify the resource identifier of the descriptive\r
                     // text for the given button.\r
 \r
                     // Specify the resource identifier of the descriptive\r
                     // text for the given button.\r
-                    idButton = lpttt->hdr.idFrom;\r
+                    idButton = (UINT)lpttt->hdr.idFrom;\r
                     switch (idButton)\r
                     {\r
                         case ID_PROP:\r
                     switch (idButton)\r
                     {\r
                         case ID_PROP:\r
@@ -309,11 +310,18 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
            case WM_COMMAND:\r
                    switch(LOWORD(wParam))\r
                    {\r
            case WM_COMMAND:\r
                    switch(LOWORD(wParam))\r
                    {\r
-                           case ID_FILE_EXIT:\r
-                                   PostMessage(hwnd, WM_CLOSE, 0, 0);\r
-                           break;\r
+                case ID_PROP:\r
+                    PropSheets(hwnd);\r
+                break;\r
+                \r
+                case ID_REFRESH:\r
+                    if (! RefreshServiceList() )\r
+                        GetError();\r
 \r
 \r
-                           case ID_START:\r
+                case ID_EXPORT:\r
+                break;\r
+\r
+                case ID_START:\r
                            break;\r
 \r
                 case ID_STOP:\r
                            break;\r
 \r
                 case ID_STOP:\r
@@ -328,11 +336,16 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                 case ID_RESTART:\r
                 break;\r
 \r
                 case ID_RESTART:\r
                 break;\r
 \r
-                case ID_REFRESH:\r
+                case ID_NEW:\r
                 break;\r
 \r
                 break;\r
 \r
-                case ID_PROP:\r
-                    PropSheets(hwnd);\r
+                case ID_HELP:\r
+                    MessageBox(NULL, _T("Help is not yet implemented\n"), \r
+                        _T("Note!"), MB_OK | MB_ICONINFORMATION);\r
+                break;\r
+\r
+                case ID_EXIT:\r
+                    PostMessage(hwnd, WM_CLOSE, 0, 0);\r
                 break;\r
 \r
                 case ID_VIEW_CUSTOMIZE:\r
                 break;\r
 \r
                 case ID_VIEW_CUSTOMIZE:\r
@@ -345,9 +358,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                               AboutDialogProc);\r
                  break;\r
 \r
                               AboutDialogProc);\r
                  break;\r
 \r
-                case ID_EXPORT:\r
-                break;\r
-\r
                    }\r
            break;\r
 \r
                    }\r
            break;\r
 \r
@@ -357,8 +367,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     return 0;\r
 }\r
 \r
     return 0;\r
 }\r
 \r
-\r
-//#pragma warning(disable : 4100)\r
+#ifdef _MSC_VER\r
+#pragma warning(disable : 4100)\r
+#endif\r
 int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance,\r
     LPSTR lpCmdLine, int nCmdShow)\r
 {\r
 int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance,\r
     LPSTR lpCmdLine, int nCmdShow)\r
 {\r
@@ -421,7 +432,7 @@ int WINAPI WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance,
             DispatchMessage(&Msg);\r
         }\r
     }\r
             DispatchMessage(&Msg);\r
         }\r
     }\r
-    return Msg.wParam;\r
+    return (int)Msg.wParam;\r
 }\r
 \r
 \r
 }\r
 \r
 \r