Helge Hafting wrote:
>>>This should work for win98:
>>>@echo off
>>>if "%LANG%"=="" SET LANG=fr_FR
>>>"C:\Program Files\LyX\bin\lyx.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9
>>>    
>>Excellent!
>>And is the existing .bat file OK on more modern Windows versions?
>>
>>@echo off
>>if "%LANG%"=="" SET LANG=fr_FR
>>"C:\Program Files\LyX\bin\lyx.exe" %~1 %~2 %~3 %~4 %~5 %~6 %~7 %~8 %~9
>>
> This seems fine to me, it works well on XP at least.
> I have no idea what surprises other versions might have in store.
> Testing will tell. :-/

Ok, then I'll use this code snippet to output the batch file:

   std::string const arg_list = is_Win2000_or_later() ?
       "%~1 %~2 %~3 %~4 %~5 %~6 %~7 %~8 %~9" :
       "%1 %2 %3 %4 %5 %6 %7 %8 %9";

where is_Win2000_or_later() is drawn from here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/verifying_the_system_version.asp

bool is_Win2000_or_later() 
{
   OSVERSIONINFOEX OS_version;
   DWORDLONG condition_mask = 0;

   // Initialize the OSVERSIONINFOEX structure.
   ZeroMemory(&OS_version, sizeof(OSVERSIONINFOEX));
   OS_version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
   OS_version.dwMajorVersion = 5;
   OS_version.dwMinorVersion = 0;
   OS_version.wServicePackMajor = 0;

   // Initialize the condition mask.
   VER_SET_CONDITION(condition_mask, VER_MAJORVERSION, VER_GREATER_EQUAL);
   VER_SET_CONDITION(condition_mask, VER_MINORVERSION, VER_GREATER_EQUAL);
   VER_SET_CONDITION(condition_mask, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);

   // Perform the test.
   return VerifyVersionInfo(
      &OS_version, 
      VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR,
      condition_mask);
}

Thanks for all your help.

-- 
Angus

Reply via email to