943,854 Members | Top Members by Rank

Ad:
Jan 14th, 2009
0

Userprofile

Expand Post »
I have a VB6 app that uses the Environ("userprofile") command to determine the location of the My Documents folder for the currently logged in user.

This has been working fine for ages with no problems. One particular client has had the user directory redirected to a network location so that he can back up all the user data. The problem I face is the Environ("userprofile") still returns the local C Drive location for the user and not the mapped network location.

How can I determine where the real user profile has been mapped to ? Is it a registry entry that can be read ?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
JohnKelly is offline Offline
26 posts
since Sep 2006
Jan 14th, 2009
1

Re: Userprofile

Hi,

Declare this API at the top :

vb Syntax (Toggle Plain Text)
  1. Private Declare Function SHGetFolderPath Lib "shfolder.dll" _
  2. Alias "SHGetFolderPathA" _
  3. (ByVal hwndOwner As Long, _
  4. ByVal nFolder As Long, _
  5. ByVal hToken As Long, _
  6. ByVal dwReserved As Long, _
  7. ByVal lpszPath As String) As Long

to Get the path :

vb Syntax (Toggle Plain Text)
  1. Dim MyPath As String
  2. MyPath = Space(260)
  3. Call SHGetFolderPath(Me.hWnd, 0, -1, &HC, MyPath)
  4. MsgBox MyPath

Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Jan 14th, 2009
0

Re: Userprofile

QVeen72 thanks for the update but is SHGetFolderPath part of the Win32 API. I can't find any record of that call.
Reputation Points: 10
Solved Threads: 0
Light Poster
JohnKelly is offline Offline
26 posts
since Sep 2006
Jan 14th, 2009
0

Re: Userprofile

QVeen72 I have got it working, many thanks for your help I am waiting to see if it reads the clients profile on their system. Thank you once again.
Reputation Points: 10
Solved Threads: 0
Light Poster
JohnKelly is offline Offline
26 posts
since Sep 2006
Jun 7th, 2009
0

Re: Userprofile

I've been trying to get the local dynamic user path to work but it doesn't seem to be.

John, what is your original code? Here is what I have but it isn't finding the file. I am using a checkbox and that feature is working but when I have it checked to use the path, it cannot find the file in that path (i.e. default.rdp). I have even tried strPath = Environ("%userprofile%\MyDocu~1") and strPath = Environ("%userprofile%\My Documents")

===> Code <===
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. strPath = Environ("%userprofile%" & "My Documents")
  2. If RDPConsole.Checked = True Then
  3. strRemoteConnect = ("mstsc /edit " & strPath & "default.rdp /v:") & IPBox1.Text
  4.  
  5. Else
  6. strRemoteConnect = ("mstsc /v:") & IPBox1.Text
  7. End If
  8. Shell(strRemoteConnect, vbNormalNoFocus)
Last edited by Tekmaven; Jun 7th, 2009 at 10:00 pm. Reason: Code Tags
Reputation Points: 10
Solved Threads: 0
Newbie Poster
1RealTruth is offline Offline
2 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Visual Basic
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Need help with error message/code





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC