Author: Lou Adler
I can't get the system icons to show in XP. All works well in Win 98 but in XP no
icons are loaded. Why?
Answer:
Because in NT each process gets its own imagelist and to minimize resources the
imagelist is populated on demand. So if the process does not request an image it is
not loaded. To force it you need to use an undocumeted function:
1 { ... }2 uses3 ShellAPI;
4 5 function FileIconInit(FullInit: BOOL): BOOL; stdcall;
6 type7 TFileIconInit = function(FullInit: BOOL): BOOL; stdcall;
8 var9 ShellDLL: HMODULE;
10 PFileIconInit: TFileIconInit;
11 begin12 Result := False;
13 if (Win32Platform = VER_PLATFORM_WIN32_NT) then14 begin15 ShellDLL := LoadLibrary(PChar(Shell32));
16 PFileIconInit := GetProcAddress(ShellDLL, PChar(660));
17 if (Assigned(PFileIconInit)) then18 Result := PFileIconInit(FullInit);
19 end;
20 end;
21 22 initialization23 FileIconInit(True);
24 25 { ... }