Código
Option Explicit 'KERNEL32 Private Declare Function GetVersion Lib "KERNEL32" () As Long 'SHELL32 Private Declare Function SHGetUserPicturePath Lib "SHELL32" Alias "#261" (ByVal pUserOrPicName As Long, ByVal sguppFlags As Long, ByVal pwszPicPath As Long, ByVal picPathLen As Long) As Long Private Declare Function xp_SHGetUserPicturePath Lib "SHELL32" Alias "#233" (ByVal pUserOrPicName As Long, ByVal sguppFlags As Long, ByVal pwszPicPath As Long) As Long Private Const SGUPP_CREATEPICTURESDIR = &H80000000 Public Function LoadUserTile() As IPictureDisp Dim sPath As String sPath = String$(256, vbNullChar) Select Case (GetVersion() And &HFF) Case 5 Call xp_SHGetUserPicturePath(0, SGUPP_CREATEPICTURESDIR, StrPtr(sPath)) Case 6 Call SHGetUserPicturePath(0, SGUPP_CREATEPICTURESDIR, StrPtr(sPath), 256) End Select sPath = Left$(sPath, InStr(1, sPath, vbNullChar) - 1) Set LoadUserTile = LoadPicture(sPath) End Function
Para probarlo añade un PictureBox en un form:
Código
Private Sub Form_Load() Picture1.Picture = LoadUserTile() End Sub
Usa un export no documentado de SHELL32.. que varía según el SO en el que estamos... por eso el GetVersion().
saludos





Autor



En línea



lamentablemente no se puede obtener la imagen de facebook o windows live sin que el usuario este conectado :/ por ende no tiene sentido.


