Bagging Some Property - Getting A Windows User's Picture Tile
Published January 03, 2012
It doesn't sound like it should be so hard. I mean, the shell has managed to produce it every time you've logged on since Windows XP.
MSDN has a page dedicated to user profiles that includes a section on where it is and how its treated. It details that a users picture lives in their temp directory, except for most times when it doesn't. It's not wrong in its description. The picture will turn up if you open the User Account control panel, but if you're trying to grab it programatically, asking the user to open Control Panel and all that or even worse, opening it from your own code and killing the window just as quick aren't fantastic solutions.
If you've searched for this before or being otherwise snooping through the shell's exported functions, you may have seen something called
SHGetUserPicturePath or its ex version
SHGetUserPicturePathEx. Just the sound of their names elicit sounds of joy, a joy that the long search is over. And it should be, except that it isn't. For one thing, up until a few weeks ago there was no public record of how to use them or what they do, at least not one picked up by Google. Now that's been rectified (with the docs above) and given the MSDN page, 2+2 would suggest these are the functions called upon opening the control panel.
Continue reading on
Just Let It Flow