Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieving the windows path
Message
 
À
17/10/2001 07:43:04
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00569185
Message ID:
00569465
Vues:
22
>>>Hi, I need to retrieve the windows path.
>>>For example... C:\windows, or c:\winnt or wherever it is installed...
>>>
>>>any ideas?
>>>
>>>thanks
>>>fabian
>>
>>? getenv('windir')
>
>George, I have an additional question.
>
>I want the folder which is usually under c:\windows\system (on a Win95 system).
>
>Do you know whether this is always = getenv("windir") + "\system", or can the "\system" part vary, depending on the OS?
>
Hilmar,

Yes, the system part will vary. On my machine, it's System32 (Win2K Pro). In order to avoid version dependence, I'd use the GetSystemDirectory API call.
DECLARE INTEGER GetSystemDirectory IN Win32API;
  STRING @lpbuffer, INTEGER uSize
lpbuffer = SPACE(260)
lnsize = LEN(lpbuffer)
lnresult = GetSystemDirectory(@lpbuffer, lnsize)
? LEFT(lpbuffer, lnresult)
For the sake of being on the safe side, you should probably check to make sure that lnresult in the above is greater than zero. If it isn't then GetLastError() will return the error info.
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform