Alexander Nicolaysen Sørnes alex@thehandofagony.com writes:
- vi.dwOSVersionInfoSize = sizeof(vi);
- GetVersionExW(&vi);
- /* On Windows 9x start does not have the process title argument.
It works such that if the first parameter begins with a double quote ("),
it is taken as the process title. Thus 'start "notepad" a' will work on
Windows 9x but not NT variants */
- if(argc > 1 && (vi.dwMajorVersion >= 5 || (vi.dwMajorVersion == 4 && vi.dwPlatformId == 2)))
The right way to check for Win9x is GetVersion() & 0x80000000.
- {
int cmdcount;
WCHAR* cmdline = GetCommandLineW();
WCHAR** cmdargs = CommandLineToArgvW(cmdline, &cmdcount);
WCHAR* pos = cmdline;
pos += lstrlenW(cmdargs[0]);
This won't work if the program name is quoted.