When switched to Report mode (View=3), the ListView control displays the resource file and ICO resource index for each icon displayed (szPath and iIcon members of SHSTOCKICONINFO structure).
That reveals that Windows 7 stores Shell icons in at least 4 files residing in System32 directory:
With known resource file and resource index, saving a Shell icon to ICO file is an easy task.
Here is another code sample on this web site that explains how. It defines VFP classes IconGroupResource and IconResource. The former creates ICO files holding multiple versions of the same icon (size & color depth vary). The latter creates ICO files holding a single icon version, for example 48x48, 8 bit.
Download a small selection of Windows icons from System32\Imageres.dll library.
The code below stores Imageres.dll Icon resources to ICO files.
IF NOT EMPTY(m.cTargetPath)
SET SAFETY OFF
nGroupIndex = 0
FOR EACH oIconGroup IN oIconGroups
"groupicon_" + TRANSFORM(nGroupIndex) + ".ico")
nIconIndex = 0
FOR EACH oIcon IN oIconGroup.icons
TRANSFORM(nGroupIndex) + "_" +;
TRANSFORM(nIconIndex) + "_" +;
TRANSFORM(oIcon.resid) + ".ico")
nIconIndex = nIconIndex + 1
nGroupIndex = nGroupIndex + 1
SET SAFETY ON
* * *
Another Icon Viewer code sample on this web site reads icons directly from .EXE or .DLL file calling ExtractIcon and GetIconInfo functions. If pointed at Shell32.dll, that viewer displays even larger number of icons then the one presented.
But the former has a deficiency. The Shell icons are retrieved based on their respective resource index in Shell32.dll. This index may fluctuate through OS versions. In contrast, the SHGetStockIconInfo uses OS-approved SHSTOCKICONID enumeration.