Author: weiden
Date: Thu Sep 27 09:49:46 2007
New Revision: 29237
URL:
http://svn.reactos.org/svn/reactos?rev=29237&view=rev
Log:
Let crt parse the command line parameters
Modified:
trunk/reactos/base/applications/control/control.c
Modified: trunk/reactos/base/applications/control/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/control/…
==============================================================================
--- trunk/reactos/base/applications/control/control.c (original)
+++ trunk/reactos/base/applications/control/control.c Thu Sep 27 09:49:46 2007
@@ -386,46 +386,39 @@
return 0;
}
-
-int WINAPI
-_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
-{
- LPTSTR lpCommandLine;
- LPTSTR lpParam;
-
- hInst = hInstance;
- CTL_DEBUG((_T("My Control Panel\r\n")));
-
- lpCommandLine = GetCommandLine();
-
- CTL_DEBUG((_T("CommandLine: %s\n"), lpCommandLine));
-
- lpParam = _tcschr(lpCommandLine, _T(' '));
- if (lpParam == NULL)
+int
+_tmain(int argc, const TCHAR *argv[])
+{
+ STARTUPINFO si;
+
+ si.cb = sizeof(si);
+ GetStartupInfo(&si);
+
+ hInst = GetModuleHandle(NULL);
+
+ if (argc <= 1)
{
/* No argument on the command line */
- return RunControlPanelWindow(nCmdShow);
- }
-
- lpParam++;
-
- if (_tcsicmp(lpParam, _T("desktop")) == 0)
+ return RunControlPanelWindow(si.wShowWindow);
+ }
+
+ if (_tcsicmp(argv[1], _T("desktop")) == 0)
{
return RunControlPanel(_T("desk.cpl"), 0);
}
- else if (_tcsicmp(lpParam, _T("date/time")) == 0)
+ else if (_tcsicmp(argv[1], _T("date/time")) == 0)
{
return RunControlPanel(_T("timedate.cpl"), 0);
}
- else if (_tcsicmp(lpParam, _T("international")) == 0)
+ else if (_tcsicmp(argv[1], _T("international")) == 0)
{
return RunControlPanel(_T("intl.cpl"), 0);
}
- else if (_tcsicmp(lpParam, _T("mouse")) == 0)
+ else if (_tcsicmp(argv[1], _T("mouse")) == 0)
{
return RunControlPanel(_T("main.cpl"), 0);
}
- else if (_tcsicmp(lpParam, _T("keyboard")) == 0)
+ else if (_tcsicmp(argv[1], _T("keyboard")) == 0)
{
return RunControlPanel(_T("main.cpl"), 1);
}