Hi,
I need to identify the pictures associated to the Users on a PC, like
the ones you find on the start session screen where you have to pick
the user for the session...
I'd love to do that in C# and I already tryed these lines but
unsuccessfully:
public Image GetUserImage(){
String ImagePath="";
String TempPath = Environment.GetEnvironmentVariable("TEMP");
String UserName =
Environment.GetEnvironmentVariable("USERNAME");
String AppPath =
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
if (Environment.OSVersion.Version.Major < 6){
ImagePath = String.Format("{0}\\{1}.bmp", TempPath,
UserName);
}else{
ImagePath = String.Format("{0}\\{1}.bmp", TempPath,
UserName);
}
string userName =
System.Environment.GetEnvironmentVariable("USERNAME");
string userLocal =
System.Environment.GetEnvironmentVariable("USERPROFILE");
string userPicture = userLocal + "\\Local Settings\\Temp\\" +
userName + ".bmp";
if (System.IO.File.Exists(userPicture))
{//ImagePath
return Image.FromFile(String.Format("{0}\\{1}.bmp",
TempPath, UserName));
}
else{
return null;
}
}
Regards,
Stef