Show system icons in Windows XP (Views: 30)
Problem/Question/Abstract: 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: { ... } uses ShellAPI; function FileIconInit(FullInit: BOOL): BOOL; stdcall; type TFileIconInit = function(FullInit: BOOL): BOOL; stdcall; var ShellDLL: HMODULE; PFileIconInit: TFileIconInit; begin Result := False; if (Win32Platform = VER_PLATFORM_WIN32_NT) then begin ShellDLL := LoadLibrary(PChar(Shell32)); PFileIconInit := GetProcAddress(ShellDLL, PChar(660)); if (Assigned(PFileIconInit)) then Result := PFileIconInit(FullInit); end; end; initialization FileIconInit(True); { ... } |