[Windows] Customize the icon of a system folder.
Posted: Thu Jan 25, 2007 5:54 am
Code updated for 5.20+
http://msdn2.microsoft.com/en-us/library/aa969337.aspx
http://msdn2.microsoft.com/en-us/library/aa969337.aspx
Code: Select all
Procedure CustomizeFolder(FolderName.s, IconName.s) ; Customize the icon of the specified folder.
If Right(FolderName, 1) <> "\"
FolderName + "\"
EndIf
Protected FileID = CreateFile(#PB_Any, FolderName + "Desktop.ini")
If FileID
WriteStringN(FileID, "[.ShellClassInfo]")
WriteStringN(FileID, "IconFile=" + IconName)
WriteStringN(FileID, "IconIndex=0")
CloseFile(FileID)
EndIf
If FileSize(FolderName + "Desktop.ini")
ProcedureReturn PathMakeSystemFolder_(FolderName)
EndIf
EndProcedure
; Specify here the folder to customize with the desired icon.
If CustomizeFolder(#PB_Compiler_Home, #PB_Compiler_Home + "Examples\Sources - Advanced\MoviePlayer\Icons\MoviePlayer.ico")
MessageRequester("Information", "OK")
EndIf