c# using shell32.dll code example
Example 1: shell32.dll c# example
public void onStartup()
{
Shell32.Shell shell = new Shell32.Shell();
Shell32.Folder objFolder = shell.NameSpace(@"C:\Windows");
this.files.Clear();
foreach (string name in ColumnListPerName)
this.files.Columns.Add(name);
foreach (int id in ColumnListPerID)
{
string header = objFolder.GetDetailsOf(null, id);
if (String.IsNullOrEmpty(header))
break;
while (this.files.Columns.Contains(header))
header += "_";
header = header.Replace("'", "_").Replace("’", "_");
Debug.WriteLine("creating column named " + header);
this.files.Columns.Add(header);
}
this.files.Columns["ID"].DataType = Type.GetType("System.Int32");
this.files.Columns[objFolder.GetDetailsOf(null, 26).Replace("'", "_").Replace("’", "_")].DataType = Type.GetType("System.Int32");
this.files.Columns["URI"].DataType = typeof(System.Uri);
ProcessLibraries();
this.files.AcceptChanges();
}
Example 2: shell32.dll c# example
private static void advanceBackgroundSlider()
{
Shell32.Shell objShell = new Shell32.Shell();
objShell.ToggleDesktop();
SendKeys.SendWait("^( )");
SendKeys.SendWait("+{F10}");
SendKeys.SendWait("{N}");
}
Example 3: shell32.dll c# example
public static bool CopyFontToWindowsFontFolder(string fontFilePath)
{
FileInfo fontFile = new FileInfo(fontFilePath);
if (!fontFile.Exists)
return false;
var windowsFontFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.Fonts);
var shell = new Shell32.Shell();
var destinationPath = Path.Combine(windowsFontFolderPath, Path.GetFileName(fontFilePath));
var folder = shell.NameSpace(windowsFontFolderPath);
folder.CopyHere(fontFilePath, 32);
return true;
}