Click here to Skip to main content
13,592,846 members
Rate this:
Please Sign up or sign in to vote.
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 25-Mar-12 23:40pm
Updated 25-Mar-12 23:54pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

For Vista and later, the image is located in C:\Users\UserName\AppData\Local\Temp\[UserName].bmp
cpquest 26-Mar-12 6:06am
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.
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...
cpquest 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

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)

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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web02-2016 | 2.8.180618.1 | Last Updated 26 Mar 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100