Hi, i have an hexadecimal value for the return value. I ask myself if i must continue to this way, i read somewhere else it was an old way to do it like a c++ copy/paste. I would to have something quick, with all default icons (i don't know another way for folders than to use win32.dll this is why i thought about make all with api methods) Meanwhile, to go forward i found a way to get mega folders, i post here if it can help others.
var identity = System.Security.Principal.WindowsIdentity.GetCurrent();
string userName = identity.Name.ToString();
string userSID = identity.User.ToString();
List MegaFolderPaths = new List();
RegistryKey clsidKey = Registry.Users.OpenSubKey($"{userSID}\\\\Software\\\\Classes\\\\CLSID");
//Get all the sub keys it contains
foreach (string subKey in clsidKey.GetSubKeyNames())
{
RegistryKey clsidSubKey = Registry.Users.OpenSubKey($"{userSID}\\\\Software\\\\Classes\\\\CLSID\\\\{subKey}\\\\Instance\\\\InitPropertyBag");
if (clsidSubKey == null)
continue;
string defaultValue = (string)clsidSubKey.GetValue("TargetFolderPath");
if (!string.IsNullOrEmpty(defaultValue))
MegaFolderPaths.Add(defaultValue);
}
------------------- Edit: for the chinese character i didn't see i forgot to add this
[DllImport("shell32.dll", CharSet = CharSet.Auto)]
above
public static extern Int32 SHGetFileInfo(IntPtr pIDL, uint dwFileAttributes,
out SHFILEINFO psfi, uint cbFileInfo, uint uFlags);