windows_programming_notes.nbk: Home | Index | Next Page: ExtCreatePen | Previous Page: Examining a Message Queue


 ExpandEnvironmentStrings

Expands environment-variable strings and replaces them with the values defined for the current user.

To specify the environment block for a particular user or the system, use the ExpandEnvironmentStringsForUser function.

Syntax

    DWORD WINAPI ExpandEnvironmentStrings(
      __in       LPCTSTR lpSrc,
      __out_opt  LPTSTR lpDst,
      __in       DWORD nSize
    );

Parameters

Return Value

If the function succeeds, the return value is the number of TCHARs stored in the destination buffer, including the terminating null character. If the destination buffer is too small to hold the expanded string, the return value is the required buffer size, in characters.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The size of the lpSrc and lpDst buffers is limited to 32K.

To replace folder names in a fully-qualified path with their associated environment-variable strings, use the PathUnExpandEnvStrings function.

To retrieve the list of environment variables for a process, use the GetEnvironmentStrings function.

Requirements


windows_programming_notes.nbk: Home | Index | Next Page: ExtCreatePen | Previous Page: Examining a Message Queue


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time