Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "WinAPI";
Текущий архив: 2008.08.31;
Скачать: [xml.tar.bz2];

Вниз

Смена иконки папки в Висте   Найти похожие ветки 

 
Tahion2   (2007-11-13 15:05) [0]

Как программно сменить иконку папки _в висте_?

 Способ, который работал в Windows XP и более ранних системах
 (записать данные о иконке в desktop.ini и обновить кэш) в висте не
 работают. Точнее работают, но только для папки, для которой иконка
 ДО ЭТОГО не менялась. Если иконка папке уже была присвоена, то
 сменить не удается.

 Any Ideas?


 
Lacmus ©   (2007-11-16 13:14) [1]

SHGetSetFolderCustomSettings ?

IconResource в desktop.ini ?


 
Tahion2   (2007-11-19 01:29) [2]

А можно какой-то пример увидеть?


 
Lacmus ©   (2007-11-22 16:59) [3]



uses
 ActiveX, ShlObj;

const
 FCS_READ        = $00000001;
 FCS_FORCEWRITE  = $00000002;
 FCS_WRITE       = (FCS_READ or FCS_FORCEWRITE);

 FCS_FLAG_DRAGDROP = 2;

 FCSM_VIEWID          = $00000001;
 FCSM_WEBVIEWTEMPLATE = $00000002;
 FCSM_INFOTIP         = $00000004;
 FCSM_CLSID           = $00000008;
 FCSM_ICONFILE        = $00000010;
 FCSM_LOGO            = $00000020;
 FCSM_FLAGS           = $00000040;

type
 SHFOLDERCUSTOMSETTINGSW = record
   dwSize : dword;
   dwMask : dword;             // IN/OUT   Which Attributes to Get/Set
   pvid : PSHELLVIEWID;               // OUT - if dwReadWrite is FCS_READ, IN - otherwise
   // The folder"s WebView template path
   pszWebViewTemplate : LPWSTR;  // OUT - if dwReadWrite is FCS_READ, IN - otherwise
   cchWebViewTemplate : DWORD;  // IN - Specifies the size of the buffer pointed to by pszWebViewTemplate
                               // Ignored if dwReadWrite is FCS_READ
   pszWebViewTemplateVersion : LPWSTR;  // currently IN only
   // Infotip for the folder
   pszInfoTip : LPWSTR;         // OUT - if dwReadWrite is FCS_READ, IN - otherwise
   cchInfoTip : DWORD;         // IN - Specifies the size of the buffer pointed to by pszInfoTip
                               // Ignored if dwReadWrite is FCS_READ
   // CLSID that points to more info in the registry
   pclsid : PCLSID;             // OUT - if dwReadWrite is FCS_READ, IN - otherwise
   // Other flags for the folder. Takes FCS_FLAG_* values
   dwFlags : DWORD;            // OUT - if dwReadWrite is FCS_READ, IN - otherwise

   pszIconFile : LPWSTR;        // OUT - if dwReadWrite is FCS_READ, IN - otherwise
   cchIconFile : DWORD;        // IN - Specifies the size of the buffer pointed to by pszIconFile
                               // Ignored if dwReadWrite is FCS_READ

   iIconIndex : integer;         // OUT - if dwReadWrite is FCS_READ, IN - otherwise

   pszLogo : LPWSTR;        // OUT - if dwReadWrite is FCS_READ, IN - otherwise
   cchLogo : DWORD;        // IN - Specifies the size of the buffer pointed to by pszIconFile
                           // Ignored if dwReadWrite is FCS_READ
 end;
 LPSHFOLDERCUSTOMSETTINGSW = ^SHFOLDERCUSTOMSETTINGSW;
 TShFolderCustomSettingsW = SHFOLDERCUSTOMSETTINGSW;
 PShFolderCustomSettingsW = LPSHFOLDERCUSTOMSETTINGSW;

function SHGetSetFolderCustomSettingsW(pfcs : PSHFOLDERCUSTOMSETTINGSW;
 pszPath : LPCWSTR; dwReadWrite : DWORD) : HResult; stdcall; external "shell32.dll";

procedure SHSetFolderIcon(const aDirectory, aIconFile: WideString);
var
 ShFolderCustomSettingsW: TShFolderCustomSettingsW;
begin
 FillChar(ShFolderCustomSettingsW, SizeOf(ShFolderCustomSettingsW), 0);
 ShFolderCustomSettingsW.dwSize := SizeOf(ShFolderCustomSettingsW);
 ShFolderCustomSettingsW.dwMask := FCSM_ICONFILE;
 ShFolderCustomSettingsW.pszIconFile := PWideChar(aIconFile);
 SHGetSetFolderCustomSettingsW(@ShFolderCustomSettingsW, PWideChar(aDirectory), FCS_WRITE);
 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST or SHCNF_FLUSHNOWAIT, nil, nil)
end;




Страницы: 1 вся ветка

Форум: "WinAPI";
Текущий архив: 2008.08.31;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.47 MB
Время: 0.006 c
6-1192736496
DprPasDcu
2007-10-18 23:41
2008.08.31
Как управлять сетевыми подключениями?


15-1215742935
Slider007
2008-07-11 06:22
2008.08.31
С днем рождения ! 11 июля 2008 пятница


3-1204739910
Tomkat
2008-03-05 20:58
2008.08.31
ошибка UDF


4-1194929446
balepa
2007-11-13 07:50
2008.08.31
CE_FRAME


15-1215775411
Nous Mellon_
2008-07-11 15:23
2008.08.31
Сокеты, php, ftp -- вопрос специалистам





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский