Click here to Skip to main content
11,637,176 members (69,675 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Windows .NET WPF system
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\\AppData\Local\Temp\.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
Edited 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
Navin Kumar.K.Subramanian at 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...
Navin Kumar K Subramanian at 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
0 stibee 313
1 295
2 OriginalGriff 295
3 himanshu agarwal 184
4 Sergey Alexandrovich Kryukov 154
0 OriginalGriff 9,031
1 Sergey Alexandrovich Kryukov 8,513
2 Mika Wendelius 6,922
3 F-ES Sitecore 2,388
4 Suvendu Shekhar Giri 2,320

Advertise | Privacy | Mobile
Web02 | 2.8.150728.1 | Last Updated 26 Mar 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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