Answer the question
In order to leave comments, you need to log in
How to programmatically change the icon of any element in Windows?
How to programmatically change the icon of any element (folder, shortcut, etc.) in Windows using C# code?
How to change path for dll file which contains icons?
Answer the question
In order to leave comments, you need to log in
not an answer to your question exactly.. but a snippet of code that generates a typical shortcut (in firefox)
static void buildLinks(this IEnumerable<string> profiles, string bro)
{
try
{
dynamic sh = Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8")));
var successCount = 0;
foreach (var p in profiles)
{
var pl = p.Split(backSlashDelimiter, StringSplitOptions.RemoveEmptyEntries);
var pnPoint = pl.Length - 2;
var profileName = pl[pnPoint];
var profileLocation = new StringBuilder()
.Append("%APPDATA%").Append(backSlash)
.Append(pl[pnPoint - 3]).Append(backSlash)
.Append(pl[pnPoint - 2]).Append(backSlash)
.Append(pl[pnPoint - 1]).Append(backSlash)
.ToString();
try
{
dynamic lnk = sh.CreateShortcut(linkLocation + profileName + ".lnk");
lnk.TargetPath = bro;
lnk.Arguments = ffOptions + " " + profileLocation + profileName;
lnk.WorkingDirectory = profileLocation;
lnk.IconLocation = iconLocation + iconName + ", " + iconIndex;
lnk.Description = "created by ff.links on C#";
lnk.Save();
" .. created link for profile ".print(pfx, profileName);
successCount++;
}
catch (Exception e) { $"FAIL create link for profile {profileName} - {e.Message}".print(pfx); }
}
$"total created links {successCount}".print(pfx);
}
catch (Exception e) { $"FAIL 'build links' - {e.Message}".print(pfx); }
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question