LPCTSTR psz,
    LPGUID pguid);

The function exists in ANSI and Unicode forms.


The psz argument is the address of an array of characters which begin with a string representation of the CLSID.

The pclsid argument is the address of a 10h-byte buffer that is to receive the binary representation of the CLSID.

Return Value

The function returns TRUE for success, else FALSE for failure.


The function succeeds if the input begins with a string representation of a CLSID, i.e., characters that match the well-known template {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} in which each x stands for any case-insensitive hexadecimal digit. Though the first character must be an opening curly brace, characters after the closing curly brace are irrelevant to the function, and are ignored. (Microsoft has code, in SHELL32, that depends on this.)

This function is natively ANSI.


The GUIDFromString function is exported from SHLWAPI.DLL as ordinals 269 and 270 (for ANSI and Unicode forms, respectively) in version 5.00 and higher. It is also exported from SHELL32.DLL as ordinals 703 and 704 in version 4.71 and higher. The implementation in SHELL32 version 5.00 and higher is just to jump to the coding in SHLWAPI.

Though this function dates from as long ago as 1999, it was still not documented by Microsoft in the MSDN Library at least as late as the CD edition dated January 2004.

The function has got documented since, apparently some time during 2005 or 2006, but anyway in time for the Windows Vista Software Development Kit (SDK) dated January 2007. None of that SDK’s header files declare the function. As if to compensate, Microsoft gives too much by dating this function from Windows 95 and even Windows NT 3.5. It is coded in SHELL32 as early as version 4.00 (from Windows 95) but not as an exported function.