Fórum Variáveis de ambiente #202500
22/12/2003
0
Preciso descobrir se determinada variável de ambiente do windows foi criada ou não. Se alguém souber como fazer para descobrir e puder mandar um exemplo, eu agradeço.
Ivo.
Ivo.
Ivo
Curtir tópico
+ 0
Responder
Posts
22/12/2003
Beppe
Você pode chamar GetEnvironmentVariables. Ela retorna uma lista delimitada por ; contendo variavel=valor.
Responder
Gostei + 0
22/12/2003
Beppe
:oops: A função correta é GetEnvironmentStrings. Para fazer mais simples, tem a função GetEnvironmentVariable que retorna o valor de um variável de ambiente. Essa função tem no D7 mas não tenho certeza de versões anteriores.
function GetEnvironmentVariable(const Name: String): String; var Len: integer; begin Result := ´´; Len := GetEnvironmentVariable(PChar(Name), nil, 0); if Len > 0 then begin SetLength(Result, Len - 1); GetEnvironmentVariable(PChar(Name), PChar(Result), Len); end; end;
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)