Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,

For my Lan Messenger i like to display the user image. The image should be the Windows current Login user image.I got some link which say that the image of the current login user image will be available in this path C:\Users\<username>\AppData\Local\Temp\<username>.bmp. But i dont see that the LAN messanger will work only for Domain Login users. so where will the user image available. As of now i didn't get any links that gives the exact solution.

1. The user can login in any of windows operating system Xp,Vista, windows 7.
how can i get that user image.
Posted
Updated 25-Mar-12 23:54pm
v2

1 solution

For Vista and later, the image is located in C:\Users\UserName\AppData\Local\Temp\[UserName].bmp
 
Share this answer
 
v2
Comments
[no name] 26-Mar-12 6:06am    
Hi,
ya i agree but the temp folder can be cleared manually or by using system cleanup. So the files in the temp folder will be deleted. and one more thing in that location we can't find the image often the image will be available only when the image is changed by the user for the first time and when you clear the temp folder it woun't get created again unless untill you change the existing image right so how can i get the image. Is there is any other option.
#realJSOP 26-Mar-12 6:53am    
I've NEVER heard of anyone doing that. I think you're worrying about a non-issue.

If you want another way to do it, you're free to use google...
[no name] 29-Mar-12 0:29am    
Hey i have got the Answer for my Question thanks. if you want the code go to the below link

http://www.codeproject.com/Articles/42282/Get-a-User-s-Full-Name

and the code

private static void GetCurrentUserProfileImage()
{
var imageFile = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) +
@"\Microsoft\User Account Pictures\" + Environment.UserDomainName + "+" + Environment.UserName + ".dat");
if (!imageFile.Exists)
return;

var desktopSaveLocation = new FileInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) +
@"\" + Environment.UserDomainName + "+" + Environment.UserName + ".bmp");
byte[] originalImageBytes = new byte[imageFile.Length];
using (var imageInputStream = imageFile.OpenRead())
imageInputStream.Read(originalImageBytes, 0, (int)imageFile.Length);
using (var imageOutput = desktopSaveLocation.Create())
imageOutput.Write(originalImageBytes, 16, originalImageBytes.Length - 200);
}



and look in to my Comments jabit is very nice he reply me in a blink of eye. thanks a lot to him.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900