WD Strings with APIs
The table below is filled with the environment variables of the system. All these variables are retrieved via a single call to the Windows GetEnvironmentStrings API. This API returns the address of a memory block containing all the variables. The initialization code of the table on the left explains how to handle the strings found in a memory block identified by its address.
Transfer the values related to the environment variable to the table on the right. This copy is performed via the call to a procedure to which the address of a structure is passed in parameter. This procedure is using the Transfer function to retrieve the structure and the information.
Note: this example illustrates the use of StringRetrieve and Transfer. The environment variables can be retrieved in WLanguage by SysEnvironment.
//-----------------------------------------------------------------------------------------
A tabela abaixo é preenchida com as variáveis de ambiente do sistema. Todas essas variáveis são recuperadas por meio de uma única chamada para a API GetEnvironmentStrings do Windows. Esta API retorna o endereço de um bloco de memória contendo todas as variáveis. O código de inicialização da tabela à esquerda explica como tratar as strings encontradas em um bloco de memória identificado por seu endereço.
Transfira os valores relacionados à variável de ambiente para a tabela à direita. Esta cópia é realizada através da chamada a um procedimento para o qual o endereço de uma estrutura é passado em parâmetro. Este procedimento está usando a função Transfer para recuperar a estrutura e as informações.
Nota: este exemplo ilustra o uso de StringRetrieve e Transfer. As variáveis de ambiente podem ser recuperadas em WLanguage por SysEnvironment.