I have the following code which works on Windows XP and Vista - both 32 and 64 bit:
public static Icon GetFolderIcon(IconSize size, FolderType folderType)
{
You shouldn't specify null as yur first parameter to SHGeFileInfo.
That's right.
Use the path to a folder instead (please note that some folders have different (non-standard) icons). You could use the temp folder or your application's root folder for example.
It doesn't need to be a real (existing) folder path. Any non-empty string will do. e.g.:
SHGetFileInfo("AnyNonEmptyStringWillDo", FILE_ATTRIBUTE_DIRECTORY, sfi,
SizeOf(sfi), SHGFI_USEFILEATTRIBUTES or SHGFI_SYSICONINDEX)